dropdown list event is not firing when javascript is used

Posted by user1511953 on Stack Overflow See other posts from Stack Overflow or by user1511953
Published on 2012-10-24T10:59:29Z Indexed on 2012/10/24 11:00 UTC
Read the original article Hit count: 145

Filed under:
|

i have a problem in firing dropdownlist event

i have following dropdown

asp:dropdownlist id="ddlhello" Runat="server" AutoPostBack="True" onchange="javascript:return ChangeHeader();"

i have also added event in code behind i.e. selectedindex change event.

Now problem occurs when i execute the page, it executes javascript but server side code doesnot fire, but if i remove this line onchange="javascript:return ChangeHeader();" then server side code fires.

when i checked source page it shows me two onchange events associated one for javascript and other for server side.

i think that it is picking client side code and neglects server side.

I am not pretty sure, so i want to know the behavior reason.

And what is the way out for this.

i want server and client side code to be executed. i have searched for solutions but i have not found any correct reason.

please reply for the same. Thanks in advance

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET