473,388 Members | 1,327 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,388 software developers and data experts.

asp:DropDownList

If I want to hang javascript off of an asp:DropDownList control, how would I
do this? There does not seem to be a "onchange" event so do I have to use
an HTML control to do this?
Jan 16 '08 #1
3 1124
myDdl.Attributes["onchange"] = "myJavascriptFunction()";

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"OldButStillLearning" <Ol*****************@discussions.microsoft.comwrot e
in message news:47**********************************@microsof t.com...
If I want to hang javascript off of an asp:DropDownList control, how would
I
do this? There does not seem to be a "onchange" event so do I have to
use
an HTML control to do this?
Jan 16 '08 #2


"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ep**************@TK2MSFTNGP06.phx.gbl...
myDdl.Attributes["onchange"] = "myJavascriptFunction()";

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"OldButStillLearning" <Ol*****************@discussions.microsoft.com>
wrote in message
news:47**********************************@microsof t.com...
>If I want to hang javascript off of an asp:DropDownList control, how
would I
do this? There does not seem to be a "onchange" event so do I have to
use
an HTML control to do this?
If I remember well you have to put this code before Page_Load ... Page_Init
is one accepted place.

HTH
--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava

Jan 17 '08 #3
That is true for dynamically created controls. Dynamically created
attributes can be added in Page_Load.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"grava" <g_*******@hotmail.comwrote in message
news:28**********************************@microsof t.com...
>

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ep**************@TK2MSFTNGP06.phx.gbl...
>myDdl.Attributes["onchange"] = "myJavascriptFunction()";

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"OldButStillLearning" <Ol*****************@discussions.microsoft.com>
wrote in message
news:47**********************************@microso ft.com...
>>If I want to hang javascript off of an asp:DropDownList control, how
would I
do this? There does not seem to be a "onchange" event so do I have to
use
an HTML control to do this?

If I remember well you have to put this code before Page_Load ...
Page_Init is one accepted place.

HTH
--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava

Jan 17 '08 #4

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

Similar topics

0
by: Ganesh Kolappan via .NET 247 | last post by:
Hi I am trying to populate a <asp:dropdownlist> in a XSLT file withdatasource pointing to a C# codebehind file method which returnsa dataview. I am using XSLT extension object. But I am...
1
by: Marius | last post by:
Hi all, I need an asp:dropdownlist on a webform that is databound to a dataset. This works fine and returns the data to populate my dropdownlist. In the DB I only have valid data, but I need a...
1
by: Harry | last post by:
Hi, Just seeing if anyone can help me with a problem I am having with drop down lists. - I have a asp:dropdownlist that gets its values from a database. - The user then selects a value then...
2
by: amessimon | last post by:
I need to display a drop down list which holds up to 250 listitems. I'd like to create this programmatically rather than have to hardcode it into the page. For example <asp:DropDownList...
1
by: Urmal Patel via .NET 247 | last post by:
I have problem with asp:Dropdownlist. I have a dropdownlist control in Page1.aspx and I want to assign value and Text to dropdown list form Page2.aspx from java script function. I am able to assign...
7
by: Lastie | last post by:
Hi all, I’ve got a ‘dropdownlist’ web control and I can add ‘listitem’ no problem. I can also bind data from an SQL database fine. My problem is that I want to do both at the same...
1
by: Xuanly ly via .NET 247 | last post by:
asp:dropdownlist always display infront of everything and I can't make it display behind HELP HELP help!!!. <form id="Form1" method="post" runat="server"> <asp:TextBox id="TextBox1"...
2
by: HH | last post by:
Hi, I have a dropdown list that is datafilled via a SQL table. The text part is always unique. (A list of countries) Each country is assigned one of three numbers. (This being the 'value' of...
1
by: Miguel Dias Moura | last post by:
Hello, I have two questions concerning Asp:DropDownList 1. How to fill a DropDownList from runtime and set its default item? 2. How do use a DropDownList in each datagrid record? All...
2
by: John Smith | last post by:
I have this DataGrid: <asp:datagrid id="dg1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="SM"> <ItemTemplate> <asp:Label id="Label2" runat="server"...
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: 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: 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?
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
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...

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.