ASP:Table 事件中复选框的动态构造问题
我目前正在动态构建一个包含复选框的asp:table 这些复选框有一个 CheckChanged 事件作为自动回发。
v_articleCheckBox.CheckedChanged += new EventHandler(v_articleCheckBox_CheckedChanged);
我将复选框状态存储在视图状态中,并且在每次页面加载时重建表,以便视图状态可以重新应用于复选框。
对于除第一个之外的每个复选框,这都可以完美地工作。
奇怪的情况是,第一个复选框适用于检查事件,但根本不调用 uncheck 事件 上的 v_articleCheckBox_CheckedChanged 方法
有人知道吗?
我正在考虑添加一个虚拟复选框作为表中的第一个条目,然后简单地向客户端隐藏它。 但这似乎是一个糟糕的解决方法。
I'm currently dynamically building an asp:table which contains checkboxes
these checkboxes have a CheckChanged event as an auto postback.
v_articleCheckBox.CheckedChanged += new EventHandler(v_articleCheckBox_CheckedChanged);
I am storing the checkbox states in the viewstate and I am rebuilding the table every page load so that the viewstate may then be re applied to the check boxes.
For every checkbox but the first this works perfectly.
The odd case is that the first checkbox works on the check event but simply does not call the v_articleCheckBox_CheckedChanged method on the uncheck event
Does anyone have an idea?
I was thinking of adding a dummy checkbox as a first entry in the table and then simply hide it from the client. but this seems to be a bad workaround.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过修改逻辑解决了这个问题,以便在更通用的基础上触发一些事件,我只是避免了这个问题。
我不知道为什么或如何发生这种情况; 我只是找到了适合我需求的解决方法。
I resolved the issue by modifying my logic so that some events were fired on a more generic basis and I simply avoided the issue.
I have no idea about the why or how this was occurring; I simply found a work around that suited my needs.