所选项目更改事件未触发下拉列表 [英] selected item change event not firing of dropdownlist

查看:53
本文介绍了所选项目更改事件未触发下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,
我在触发dropdownlist事件时遇到问题
我有以下下拉菜单

hi friends,
i have a problem in firing dropdownlist event
i have following dropdown

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



我还在代码后面添加了事件,即selectedindex更改事件.

现在,当我执行该页面时会发生问题,它会执行javascript,但是不会触发服务器端代码,但是如果我删除此行onchange="javascript:return ChangeHeader();",则将触发服务器端代码.

当我检查源页面时,它向我显示了两个关联的onchange事件
一个用于javascript,另一个用于服务器端.

我认为这是在选择客户端代码,而忽略了服务器端.

我不太确定,所以我想知道行为原因.
而这的出路是什么.

我希望执行服务器和客户端代码.
我一直在寻找解决方案,但没有找到任何正确的原因. 请同样答复.在此先感谢



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

推荐答案

,您可能尚未添加return true;在javascript的ChangeHeader()函数的末尾...
you might have not added return true; at the end of the ChangeHeader() function in javascript...


这篇关于所选项目更改事件未触发下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆