CheckedChabge dynamically

G

Guest

I have no idea how to get the IDs of dynamically genrated CheckBoxes and the
events of CheckedChange.

I have dynamically generated array of CheckBoxes, checkboxes,which
dynamically display in a table of a web form when Page_Load.
(1) I want determine if the status of checkboxes(i, j) from checked to
Unchecked or Array(k,j) from unchecked to checked.
(2) The procedure like the following can only be used for predefined the
checkbox in the form (i.e., the ID is already known). So it would not work
for me. How to get the IDs when they are dynamically generated (see (3))?
Private Sub CheckBox_CheckedChanged(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
CheckBox.CheckedChanged
................
End Sub

(3) While the checkboxes, checkboxes(j, i), are generated, I use
checkBoxIDs(j, i) = checkboxes(j, i).ClientID
to try to get their ID. But it does not work.

Could anyone here give me help?

Thanks

David
 
G

garethdjames

when you create the checkboxes add a event handler to the
CheckedChanged event (for the dynamic checkbox), set the delegate to be
a method with the correct signature,

now when the page loads (even in post back) you first need to
reconstruct the checkboxes, the event will then be wired up
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top