asp:DropDownList

  • Thread starter OldButStillLearning
  • Start date
O

OldButStillLearning

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?
 
G

grava

Eliyahu Goldin said:
myDdl.Attributes["onchange"] = "myJavascriptFunction()";

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


"OldButStillLearning" <[email protected]>
wrote in message
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
 
E

Eliyahu Goldin

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 said:
Eliyahu Goldin said:
myDdl.Attributes["onchange"] = "myJavascriptFunction()";

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


"OldButStillLearning" <[email protected]>
wrote in message
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top