views:

114

answers:

3

Using .Net, I need to generate a response based on only the checkboxes on my form that have had there states changed. So how do I know if the check box has changed from its previous value before submission. I can't use the onchange event because the user may check multiple boxes before submitting.

A: 

Use the CheckStateChanged (or whatever) event to flag a change (you can store the name in a List, for example), and then use the event from the submit button to save the changes.

Jouke van der Maas
+1  A: 

Use the event CheckedChanged

check.CheckedChanged += new EventHandler(check_CheckedChanged);
protected void check_CheckedChanged(object sender, EventArgs e)
{
    //do stugg
}
skyfoot
+1  A: 

If you compare the previous values with the current values and they are not the same, then they have changed.

So save the previous state into an object, and compare that object with the current state. (recording the changes made gets more complicated as if you change something twice you'd not submit it as a change)

Pete Kirkham