I want to know the client side events (like onChange) for an asp:DropDownList.
The DropDownList control is a web server element that creates the drop-down menu and lets users select a single item from various options. You can add any number of items to the DropDownList. Almost all web pages contain a drop-down list, but it is mostly present in registration forms or sign-in pages.
Those of you who worked with ASP.NET web forms will recollect that certain server controls such as DropDownList have a property called AutoPostBack. This property when set to true automatically submits the form to the server whenever the selection changes and raises some server side event.
Are you talking about ASP app? This app produces HTML code so you have all HTML events available, which for the select
tag (select
is a HTML tag for dropdown lists) are the following:
onchange
onclick
ondblclick
onmousedown
onmouseup
onmouseover
onmousemove
onmouseout
onkeypress
onkeydown
onkeyup
onfocus
onblur
You can assign the onchange client-side event to a DropDownList control programmatically:
DropDownListID.Attributes["onchange"] = "javaScriptFunction();";
Give a look to this article:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With