views:

30

answers:

1

Hi, here's my story:

I have two checkboxes: cb1 and cb2. They are both hooked up to an onClick event which checks if at least one checkbox is clicked. If this is not the case, it throws an alert and reverts the change. If a legal change was made (e.g. cb2 was checked, followed by cb1 being unchecked), the function calls the server function checkChange() which needs the object and eventargs.

I'm having trouble with the following:

  • Reverting the change: how can i find out which checkbox was clicked without adding an extra javascript function for the second checkbox? This has to be a scalable solution as more checkboxes may be added later.
  • How do I call the server function checkChange(). I am aware of "this.Page.GetPostbackEventReference" but I am confused as to the parameters it takes.

Thanks for looking.

+2  A: 

To find out which checkbox was clicked, you can add an extra parameter that takes this or some type of checkbox id to your onClick callback.

a.feng
please elaborate.
Freakishly
thanks, this is what I was looking for.
Freakishly