请教怎样拿动态Checkbox的值?我先定了一个 mybox(10) as checkbox, mycount as integer,
然后在pageload里: for count = 1 to 10
Mybox(count) = new checkbox
然后把Mybox(count) 放在一个HTML TABLE之内.
但当我在一个button click event中想做:
Count = 1
If mybox(count).checked= true then
Xxxx
End if 时, ERROR -- “object reference not set to an instance of an object”
然后在pageload里: for count = 1 to 10
Mybox(count) = new checkbox
然后把Mybox(count) 放在一个HTML TABLE之内.
但当我在一个button click event中想做:
Count = 1
If mybox(count).checked= true then
Xxxx
End if 时, ERROR -- “object reference not set to an instance of an object”
然后,通过下面的语句应该能获得是否选择
string Selectedvalue = Request.Form[clientID].ToLower();
selectedValue应该等于“true”或“false”;
(我是后台动态生成radiobutton,可以获得radiobutton的Value,你试试吧)