DropdownList autoposback after client confirmation

Posted by Aamir on Stack Overflow See other posts from Stack Overflow or by Aamir
Published on 2008-09-16T15:43:06Z Indexed on 2010/04/23 1:23 UTC
Read the original article Hit count: 298

I have a dropdownlist with the autopostback set to true. I want the user to confirm if they really want to change the value, which on post back fires a server side event (selectedindexchanged).

I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but it will not postback regardless of the confirm result and the value in the list does not revert back if cancel selected.

When I remove the onchange attribute from the DropdownList tag, the page does postback. It does not when the onchange attribute is added. Do I still need to wire the event handler (I'm on C# .Net 2.0 ).

Any leads will be helpful.

Thanks!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about dropdownlist