|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
drop down list box - client side code won't execute OnSelectedIndexChangeI am trying to get a client side javascript function to invoke when the
selection changes in a drop down list box. I have tried : ddl_specs.Attributes["language"] = "javascript"; ddl_specs.Attributes["OnSelectedIndexChanged"] = "return OnChangeSpec();"; with & without the "return"; and with & without AutoPostBack = true on the list box property and the javascript function just will not execute. I have gotten client side java script to work on an asp:button by adding the javascript function via the attributes collection, so I am not sure what else could be going on here. Much Thanks. The client-side event name is "onchange", e.g.
ddl_specs.Attributes.Add ("onChange", "OnChangeSpec();"); SelectedIndexChanged is the server-side event which can be used as this: ddl_specs.SelectedIndexChanged +=new EventHandler(ddl_specs_SelectedIndexChanged); Show quoteHide quote "ezela***@hotmail.com" wrote: > I am trying to get a client side javascript function to invoke when the > selection changes in a drop down list box. I have tried : > > ddl_specs.Attributes["language"] = "javascript"; > ddl_specs.Attributes["OnSelectedIndexChanged"] = "return > OnChangeSpec();"; > > with & without the "return"; and with & without AutoPostBack = true on > the list box property and the javascript function just will not > execute. > > I have gotten client side java script to work on an asp:button by > adding the javascript function via the attributes collection, so I am > not sure what else could be going on here. > > Much Thanks. > > You are welcome.
The ASP.NET web server controls render HTML objects on the browser. Therefore to manipulate any server control on the browser (using custom JavaScript) one has to study the HTML objects that they render. For example the DropDownList server control renders an HTML object named <SELECT> on the browser. By searching the MSDN for documentation on SELECT you would get its properties and events: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/select.asp Show quoteHide quote "ezela***@hotmail.com" wrote: > Thanks! Where would I have found this? (besides posting the > question). > > There are probably many places, but here is one of my favorite sites as a
reference for Javascript code (and other languages commonly used on the web): http://www.devguru.com/Technologies/ecmascript/quickref/js_eventhandler.html Good luck! -- Show quoteHide quoteNathan Sokalski njsokal***@hotmail.com http://www.nathansokalski.com/ <ezela***@hotmail.com> wrote in message news:1133469816.372181.110250@g14g2000cwa.googlegroups.com... > Thanks! Where would I have found this? (besides posting the > question). > The proper javascript event for drop down lists is onChange.
ddl_specs.attributes.add("onchange","return OnChangeSpec();") ---- 700cb Development, Inc. http://www.700cb.net ..NET utilities, developer tools, and enterprise solutions ezela***@hotmail.com wrote in news:1133463351.201242.34780 @g47g2000cwa.googlegroups.com: Show quoteHide quote > I am trying to get a client side javascript function to invoke when the > selection changes in a drop down list box. I have tried : > > ddl_specs.Attributes["language"] = "javascript"; > ddl_specs.Attributes["OnSelectedIndexChanged"] = "return > OnChangeSpec();"; > > with & without the "return"; and with & without AutoPostBack = true on > the list box property and the javascript function just will not > execute. > > I have gotten client side java script to work on an asp:button by > adding the javascript function via the attributes collection, so I am > not sure what else could be going on here. > > Much Thanks. > > --
VS2005 is a PIECE of Garbage and is bug Ridden
Checkbox and Javascript VS2005 DataList with Nested GridView using ObjectDataSource BoundField and DataFormatString in ASP.NET 2.0 - Bug ? issues using webbrowser in a service Problem with Custom Web Controls in Visual Studio 2005 GridView whole row select Custom control that ingerits from textbox Losing Session Values gridview.boundfield.dataformatstring doesn't work |
|||||||||||||||||||||||