Check all checkboxes in checkboxlist with one click using c#

后端 未结 6 967
傲寒
傲寒 2021-02-03 22:46

I want to have a button that once clicked, it will select all checkboxes in my checklistbox. I\'ve search the possible answers but I always see examples for asp.net and javascri

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-03 23:04

    Call a method from code behind in C# and write this piece of code, then you could be able to check/uncheck them. This checks or uncheck all the check boxes present in the checkboxlist. Hope it might help.

    foreach (ListItem item in CheckBoxList.Items)
    {
        item.Selected = true;    
    }
    

提交回复
热议问题