473,698 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing javascript for dropdownlist selectedIndexCh ange



Hello,

I have a dropdownlist server control.On selectedIndexCh ange 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 display confirmation alert.
How can I use the javascript confirmation alert in code behind?

any help?

Thanks
Mangala Bhat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
2 5073
You can execute a line of code like this when you want a message box to be
displayed.
(This writes out the necessary client side javascript to your HTML page to
make the alert pop up as soon as the page is sent to their browser.)

RegisterStartup Script("startup Script", "<script
language=JavaSc ript>alert('Thi s is my message.');</script>");

Here's more info:
http://msdn.microsoft.com/library/de...criptTopic.asp

Here are a couple controls you might find to be useful:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
http://www.jttz.com/msgbox/index.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"MBhat" <ma*****@devx.c om> wrote in message
news:Oa******** ******@TK2MSFTN GP10.phx.gbl...


Hello,

I have a dropdownlist server control.On selectedIndexCh ange 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 display confirmation alert.
How can I use the javascript confirmation alert in code behind?

any help?

Thanks
Mangala Bhat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

Hello,

Let me be more clear about my problem.

I have a dropdownlist server control. I have written SelectedIndexCh ange
method for this. Now I also need to write a javascript function which
has a confirmation message in it for the same SelectedIndexCh ange
method.

I wrote it like this
mDrpCounties.At tributes.Add("o nchange", "CheckAlert();" )

I noticed one thing here..The first time when the selectedIndexCh ange
method is called the javascript doesn't fire. but the second time when
its done, javascript fires.

Why is that??? Can you tell me??

I tried to do RegisterStartup Script,Register ClientScriptBlo ck but
nothing is working.

Thanks
MBhat
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

1
7957
by: Paul C | last post by:
Can anyone tell me why I am getting 2 calls to my SelectedIndexChange event. public class Browse : System.Web.UI.Page { protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Web.UI.WebControls.DropDownList DropDownConf; protected DataSet BrowseOrders=null;
3
1538
by: Paraki | last post by:
Hi, I have 4 items in a dropdownlist. After selecting the item the dropdownlist gets disabled. this operation is performed in selectedIndexChangeCommited event. Now the problem is, I hignlight the 3rd item and tab out from the list. The 1st item is getting selected and the list becomes disabled. Anyone knows why this is happening? Any help will be appreciated.
1
1935
by: Jay | last post by:
I have dropdownlist in a usercontrol and selectedindexchange event captured. But Iam seeing fire twice. Thanks.
1
1939
by: Ravi | last post by:
I am trying to represent master-detail records from a database The general logic will be populating the first dropdownlist with the master records and on change of the first dropdownlis getting the selectedindex and querying the database and populating the childrecords in the second dropdownlist But my question is how the same can be acheieved by using "Relations" The following code fragment i tried, but i have no idea how to proceed ...
1
1723
by: ProSAAP | last post by:
I need help. I am attaching both the html stuff as well as the code snippet that is not firing. Can someone please help me Thank Sub InputPub_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ HandlesInputPub.SelectedIndexChange Dim PubNew, AdTypeNew As Strin ComboBoxLostFocus(InputPub PubNew = ComboBoxCurrentCode(InputPub AdTypeNew = ComboBoxCurrentCode(AdType SetComboBoxText(AdType, "ADTP", msPubSave.Value,...
4
2073
by: Yahya Saad | last post by:
Dear All, I have an ASP.Net webform that includes a DropDownList (bound to a dataview including 6000 records) and a textbox that is updated according to the selection of an event at the SelectedIndexChange of the DropDownList. Filling the DropDownList takes about 3 seconds but when the SelectedIndex of the DropDownList is changed it takes about a minute for the webform to respond. How can i speed up my pages response, knowing that I have...
2
3218
by: Kevin | last post by:
Hi I need to get the "ItemId" from the selected value of the DropDownList in a DataList, but i don't known where tu put the <%# DataBinder.Eval(Container.DataItem, "ItemId"), because if I try to put in the ID of the DropDownList generate an error. I've used this code, i catch the SelectedIndexChange. HTML: <asp:DataList id="dlDropDownList" runat="server"> <ItemTemplate>
3
1460
by: Kim | last post by:
I have a user control with 3 dropdownlist when a user selects the first listbox based on his/her selection the 2 listbox will load based off the users selection from the 2nd listbox the 3rd listbox will load. My problem is the first listbox works but when the user selects the 2nd listbox the event fires but not in the selectedindexchange event all of the dropdownlist have autopostback set to true. I have debug and found that when I...
1
8485
by: affi | last post by:
Hi all, I m new to javascript and web development for that matter, so, my questions may sound dumb...........but i will really apperciate any solution ASAP as i m facing a deadline............ my 1st problem is i have two TEXTBOXES in my ASP.NET page. one is a normal control, other is a READ-ONLY field . On certain event i m toggling(interchanging) the text values of both the textboxes using javascript and i m using the hidden fields to...
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.