ASP.NET 2.0:使用 AutoPostBack=true 从 onChange 调用 javascript 函数
我有一个 ASP.NET DDL,当我查看源代码时,它看起来像这样:
<select name="testControl" onchange="DoCustomStuff();setTimeout('__doPostBack(\'testControl\',\'\')', 0)" id="testControl">
它在 .cs 页面上看起来像这样:
<asp:DropDownList ID="testControl" runat="server" onchange="DoCustomStuff()" OnSelectedIndexChanged="testControl_Changed" AutoPostBack="true" />
任何人都可以看到在这样的 DDL 上使用 onchange 和 AutoPostBack="true" 的问题吗? 我问这个问题是因为我们有一些用户的 DoCustomStuff() 似乎没有被正确调用,我想知道 __doPostBack() 是否可以在 DoCustomStuff() 完成其工作之前执行。
I have an ASP.NET DDL that looks like this when I view source:
<select name="testControl" onchange="DoCustomStuff();setTimeout('__doPostBack(\'testControl\',\'\')', 0)" id="testControl">
It looks like this on the .cs page:
<asp:DropDownList ID="testControl" runat="server" onchange="DoCustomStuff()" OnSelectedIndexChanged="testControl_Changed" AutoPostBack="true" />
Can anyone see a problem with using onchange and AutoPostBack="true" on a DDL like this? I ask because we have some users for whom the DoCustomStuff() doesn't seem to be called correctly, and I'm wondering if it would be possible for the __doPostBack() to be executed before DoCustomStuff() completes its work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试像这样手动附加回发引用:
这为您提供回发客户端参考:
Try to attach postback reference manually like that :
this gives you the postback client side reference :