473,394 Members | 1,715 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,394 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 1754
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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.