Check multiple items in ASP.NET CheckboxList

后端 未结 4 747
误落风尘
误落风尘 2021-01-02 09:03

I try to check multiple values in ASP.NET CheckboxList but I couldn\'t.
I Wrote :

chkApplications.SelectedValue = 2;
chkApplications.SelectedValue = 6;         


        
4条回答
  •  無奈伤痛
    2021-01-02 09:34

    you can put the value in a list (MyList), and use FindByValue to check them.

    foreach (var item in MyList)
    {
        checkBoxList.Items.FindByValue(item.id).Selected = true;
    }
    

提交回复
热议问题