I want to take the text and value from selected and not selected elements from CheckBoxList and insert in datatable
MultiCheckCombo Reference
Now I want to get text and value from this checklist,
I think it would be comfortable to place in a DataTable
public DataTable GetAllChechedBox()
{
var dt = new DataTable();
for (int i = 0; i < chkList.Items.Count; i++)
{
if (chkList.Items[i].Selected)
{
dt.Columns.Add("Name");
dt.Columns.Add("Value");
// how add all checked with value and text in this datatable?
}
}
return dt;
}
/also want to take a function with text and value for unselected elements/
Instead of chkList.Items[i].Selected, use chkList.Items[i].Checked….plus
add column outside loop