JavaScript - onchange Event Not fire ?? - Asked By ALOK RANJAN on 03-Jul-12 12:44 AM


I have a scenario that i want to call onchange event on dopdownlist controal but it is not fire....

i have make function of JS and we call this function on dropdownlist control of onchange event but it is not fire please
provide solution ASAP


Jitendra Faye replied to ALOK RANJAN on 03-Jul-12 01:15 AM
I have created one example for problem ,Follow this code-

 <script type="text/javascript">
 function show() {
        var drp = document.getElementById('<%=DropDownList3.ClientID%>');
        document.getElementById('<%=Label1.ClientID%>').innerHTML  =drp.value;
        return false;


 <asp:DropDownList ID="DropDownList3" runat="server">
       <asp:Label ID="Label1" runat="server"></asp:Label>

Now in server side-

protected void Page_Load(object sender, EventArgs e)
       DropDownList3.Attributes.Add("onchange", "return show();");  

Try this code and let me know.