javascript confirmation from DropdownList onSelectedIndexChanged e

P

PK9

Please help:
I have a DropdownList control that has a server-side onSelectedIndexChanged
event handler. Before this server-side event handler is run, I'd like a
client-side javascript confirmation box to appear for the user to select
whether or not to continue. I've tried adding an onselectedindexchanged
event handler in the Page.Load, I've tried Page.RegisterStartupScripts, but I
can't figure it out.

Here's my code:
ASPX Page:
<asp:DropDownList id="lstRecordsReturned" runat="server" AutoPostBack="True"
onSelectedIndexChanged="lstRecordsReturned_Click" />

So BEFORE the server-side handler method (lstRecordsReturned_Click) is
invoked, I want a javascript confirmation box to appear to the user first
allowing them to decide whether or not to proceed (i.e. return confirm('You
will lose unsaved changes, to proceed click OK, otherwise click cancel');).
I can't figure out the code to implement this type of functionality.

Any help is greatly appreciated.
 

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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top