views:

29

answers:

1

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

A: 

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

Use the FindControl method:

CheckBox cb = (CheckBox)this.FindControl("chk_1");
zincorp
this doesn't work, i am creating my check box in the page_load
WingMan20-10
Ah, I see - I thought you were adding them on the client side. Editing answer..
zincorp