使用 C#.Net 仅显示 CheckBoxList 中选中的项目:
我在 CheckBoxList 上方有一个复选框,其文本为“仅显示所选项目”。
我的 CheckBoxList 有 10 个项目,其中 3 个项目为“选定”。
但是当我检查复选框时,我只想显示 CheckBoxList 中选定的三个项目。 当我取消选中复选框时,我想显示所有 10 个项目和选定的三个项目。
如何做到这一点?
I have One CheckBox above the CheckBoxList and its Text as "Show only Selected Items".
My CheckBoxList has 10 items and three items as Selected.
But when I Check the CheckBox, I want to display only the selected three items in the CheckBoxList.
When I uncheck the CheckBox, I want to display all the 10 items and three items as selected.
How to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在“仅显示所选项目”复选框的选中事件中,循环并检查哪个已选中,如果未选中复选框列表的复选框,则从复选框列表中删除/可见该项目。
in the checked event of checkbox of "Show only Selected Items", do loop and check which is checked and if checkbox of checkboxlist is not selected then remove/visible false that item from checkboxlist.
每个复选框的 aspx 页面都需要 onchecked 更改
您后面的代码。
像这样的东西......这是一种伪代码,但希望它背后的逻辑就是您正在寻找的。
Your aspx page for each checkbox needs the onchecked change
Your code behind.
Something like this... this is kind of pseudo code but hopefully the logic behind it is what you're looking for.