asp:DropDownList

  • Thread starter Thread starter OldButStillLearning
  • Start date 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?
 
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
 
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
 
Back
Top