来自 DataBound 控件内部的事件
我有一个 asp:Repeater ,其中有一个 asp:DropDownList 。中继器中的 DropDownList 在每次回发时都会引发其 SelectedIndexChanged 事件,无论它们是否已更改。
这是 ASP.NET 中的已知问题吗?你知道如何解决它吗?
我找到了此解决方法 但如果可能的话,想要一些更漂亮的东西。
I have an asp:Repeater with an asp:DropDownList in it. The DropDownLists in the repeater raise their SelectedIndexChanged events on every postback, regardless of whether they were changed or not.
Is this a known issue in ASP.NET? Do you know how to work around it?
I found this workaround but would like something prettier if at all possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,我找到了 - 我正在代码隐藏中添加事件处理程序,但是当我将其移动到 ASP.NET 标记中的 asp:DropDownList 控件的 OnSelectedIndexChanged 属性时,一切都开始正常运行。
Ah I found it - I was adding the event handler in codebehind, but when I moved it to the OnSelectedIndexChanged attribute of the asp:DropDownList control in the ASP.NET markup everything started behaving correctly.