在每次检查时保存复选框列表项的值
我有一个包含 9 个项目的复选框列表..
用户可以检查的最大检查数量只有 3....
我该如何做类似的事情...
(1) 在第一次检查时,将项目值存储在labelA..
(2) 第2次检查时,将项目值存储在labelB中..
(3) 第3次检查时,将项目值存储在labelC中..
(4) 用户每次检查任何时间,执行actionA,其中将利用储值从3个标签?
请帮忙...我需要在今天之前完成它...
I have a checkboxlist containing 9 items..
The max no of checks that a user can check is only 3....
How do I go about doing something like...
(1) on the 1st check, store the item value in labelA..
(2) on the 2nd check, store the item value in labelB..
(3) on the 3rd check, store the item value in labelC..
(4) Each time the user check on any time, perform actionA which will make use of the store value from the 3 labels?
pls help... I need to get it done by today...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要设置
AutoPostBack=True
并处理CheckBoxList控件的SelectedIndexChanged
事件。You need to set
AutoPostBack=True
and handleSelectedIndexChanged
event of CheckBoxList control.只需使用计数器即可。每次选中一个复选框时,增加该数字,如果等于 3,则将其回滚到 0。
要使您只能选中 3 个,请有一个包含最后 3 个复选框的队列,然后取消选中队列中最旧的复选框当检查一个新的时。
Just use a counter. Every time a checkbox is checked, increase that number and roll it back to 0 if it's equal to 3.
To make it so that you can only check 3, have a queue of the last 3 checkboxes and then uncheck the oldest checkbox in the queue when a new one is checked.