Click here to Skip to main content
15,905,971 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi friends,
i have a problem in firing dropdownlist event
i have following dropdown
ASP.NET
<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
Posted
Updated 23-Oct-12 2:56am
v3

1 solution

you might have not added return true; at the end of the ChangeHeader() function in javascript...
 
Share this answer
 
Comments
preet88 23-Oct-12 8:55am    
i have returned true, but that was not working.
its .NET 2002 in which i am making this change.
Vijay Radia 27-Oct-12 7:47am    
If there is an error in javascript function then it returns false, please check for it also.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900