retrieve selectedvalues from checkedlistbox ion .net 2.0
C#
1
Posts
1
Posters
0
Views
1
Watching
-
This is how a checkedlistcontrol is populated: chklstUserRoles.DataSource = dsUsersAndRoles.Tables["Roles"].DefaultView; chklstUserRoles.DisplayMember = "Name"; chklstUserRoles.ValueMember = "RoleID"; I would like to loop through a checkedlistBox control and collect the IDs that is allocated to each checked item in the control. This does not quite work: for (int i = 0; i <= chklstUserRoles.CheckedItems.Count - 1; i++) { strRoleIds += chklstUserRoles.SelectedValue.ToString() + ","; //strRoleIds += chklstUserRoles.CheckedItems[i].ToString() + ","; } Thanks