473,406 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Launch javascript confirmation box from DropdownList onSelectedInd

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.
--
PK9
Jul 21 '05 #1
1 1755
Hi again :)
I posted a message before and I think it will solve this problem too.

lstRecordsReturned.Attributes.Add("OnChange",
"here_s_a_javascript_function");
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
8
by: Brent_White_99 | last post by:
I copied the code from another HTML script that someone before me had written. I have no Javascript experience (I'm a VB Programmer/DBA) at all. The code below works to a certain extent. There...
2
by: MBhat | last post by:
Hello, I have a dropdownlist server control.On selectedIndexChange I do some functionality. In addtion to this I need to check for something else. To do this I have to use javascript function to...
1
by: PK9 | last post by:
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...
1
by: dapkniht | last post by:
Hello, Here's my situation... I have an ASP.NET 2.0 (C#) page with a link button. When a user clicks the button I need it to execute the code behind code for the link button on click event. At...
3
by: Darrel | last post by:
I have a page that lists a bunch of items. You can check each item and hit ADD to add these items to a record in the DB. This page has a dropDownList. When you select an item from the list, I...
2
by: bay_dar | last post by:
Hi, I have an internal ASP.NET application that I'm are using to send e-mails out based on a single milepost or milepost range entered. I'm trying to do two things when a user clicks on the...
4
by: basm101 | last post by:
Hello, I need to know how to create closing tag elements when using DOM to add in form elements to a page. Here is the code...the <div> I am adding to the page is called dropDownList (for...
2
by: pankajsingh5k | last post by:
Dear All, Please help me... I had read an article to lazy load a tab in a tabcontainer using an update panel on http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.