Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DropDownList fires MessageBox

Status
Not open for further replies.

Iamthestig

Programmer
Apr 30, 2008
38
GB
Hi,

I'm not sure if this can be done.
I am using ASP.Net 2.0 / VS 2008 / VB

I have a page with a dropdownlist of user names. When the list is clicked (or before a user name is changed) I want to display a messagebox reminding the user to Save the current Page. Like: "Have you saved this page?" With Yes No buttons. Then cancel the dropdownlist from changing if they click No.
I can do this with a button, can it be done with a dropdownlist?

Many thanks.
 
You will not be able to have 'Yes' and 'No' buttons with the standard 'confirm' box - they will be 'OK' and 'Cancel'.

If you want 'Yes' and 'No', you'll have to roll your own DHTML version, or use VBScript (which means IE only).

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Thanks Dan,

I can live with OK and Cancel.

With a button I would use this:

<asp:Button runat="server" id="btnSubmit" Text="Submit" OnClientClick="return confirm('Proceed');" />

btnSubmit.Attributes.Add("onClick", "return confirm('Proceed');")

do you know the code to trigger the dropdownlist? I have tried OnPreRender and OnTextChanged but with no luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top