如何在c#中保存buttonclicked事件后清除checkboxlist检查的项目 [英] how to clear the checkboxlist checked items after save buttonclicked event in c#

查看:133
本文介绍了如何在c#中保存buttonclicked事件后清除checkboxlist检查的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中保存buttonclick事件后清除checkboxlist检查项目

how to clear the checkboxlist checked items after save buttonclick event in c#

推荐答案

Rebind是一个选项,但我不建议。相反,只需:

Rebind is an option, but I would not suggest it. Instead, just do:
foreach (ListItem item in lstMultipleValues.Items)
{
//check anything out here
if (item.Selected)
  item.Selected= false;
}






在button_Click事件中添加以下行:



Hi,

Add the following lines in your button_Click event:

int count = CheckBoxList1.Items.Count;
        for (int i = 0; i < count; i++)
        {
            if (CheckBoxList1.Items[i].Selected == true)
            {
                CheckBoxList1.Items[i].Selected = false;
            }
        }





谢谢



thank you


试试这个..



chkList.ClearSelection();
Try this ..

chkList.ClearSelection();


这篇关于如何在c#中保存buttonclicked事件后清除checkboxlist检查的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆