开发者

heDynamically Creating Check box

开发者 https://www.devze.com 2022-12-20 01:03 出处:网络
i am creating check box\'s dynamically and assigning them names like \"chk_1\" and \"chk_2\". now if later in my code i want to check if they have been checked how can i do that.

i am creating check box's dynamically and assigning them names like "chk_1" and "chk_2".

now if later in my code i want to check if they have been checked how can i do that.

if i do something like if chk_1.checked is True then i am getting error that chk_1 is not declared.

Which is true.

am i making sense??

i am using VB.net 2.0 i can post my code开发者_开发技巧 if needed.

thanks


EDIT: After clarification that these are being added on the server-side:

Use the FindControl method:

CheckBox cb = (CheckBox)this.FindControl("chk_1");
0

精彩评论

暂无评论...
验证码 换一张
取 消