Event handler for check box
-
Hi all I have 20 check boxes in my page and i need to fire the checkbox checked event for all check boxes. Instead of writing the checked event for each and every checkbox is there any way to fire the checked event with only one function.i need to get check box id if it is checked. I'm doing in C#.Net web application Thank you.
siri
-
Hi all I have 20 check boxes in my page and i need to fire the checkbox checked event for all check boxes. Instead of writing the checked event for each and every checkbox is there any way to fire the checked event with only one function.i need to get check box id if it is checked. I'm doing in C#.Net web application Thank you.
siri
Write something like this in the constructor or the form's
Load
event or whatever.checkBox1.CheckedChanged += checkBox_CheckedChanged // the checkBox_CheckedChanged function
//now handles the CheckedChanged event of checkBox1
checkBox2.CheckedChanged += checkBox_CheckedChanged
checkBox3.CheckedChanged += checkBox_CheckedChanged
//...Or you can simply set the
CheckedChanged
handler function from the Properties window (the Events section) for the checkboxes. And to know which fired the event, it's thesender
argument of the handler.CheckBox Sender = (CheckBox)sender; //unbox to checkbox
Eslam Afifi