How to check items in checkbox list ?
Are you looking for a way to check items in checkbox list ? then read this thread to know how to check it
Hello,
I am having a CheckBoxList which is databound with a sql data source control and runtime it is fetching data from the database and displaying it.
Now, from another table, I am having several data which I am fetching at code behind of the same page using vb.net code and wanting to match these data with the already binded data of the CheckListBox and if there will be any match, then that particular matched data/item will be selected on the CheckListBox.
The code is as follows:-
-
Dim old_desired_expertise As String = ds.Tables(0).Rows(0)(5).ToString
Dim words As String() = old_desired_expertise.Split(New Char() {","c})
Dim word As String
For Each word In words
For Each li As ListItem In chkboxlist_desired_expertise.Items
If li.Text = word Then
li.Selected = True
End If
Next
Next
But the abovde code is not working al all.
Please Note: In the "ds.Tables(0).Rows(0)(5).ToString", I am having a string of comma separated values which is stored in the database.
I am looking the help for the same, from you.