Hello DNN community,
I'll try to keep things generic so others can apply this to their situtations.
I have a CheckBoxList control that is databound to a LinqDataSource. TableA is like this:
ID | Name
1 | Paul
2 | Bill
and so on....
Table B is
ModuleID | LoadTypes
1032 | 1,2
The index values from the checkboxlist are equal to the ID's from the table. I then have to store these values in TableB as a CSV list. So I do the following:
Dim strListItemIDs As String = ""
For Each li In chkListTypes.Items
If li.Selected Then
strListItemIDs += li.Value & ","
End If
Next
(Yes I trim the comma off later on)
So where I am stuck is on the return trip to this page the check boxes need to be selected from this CSV list of values. I get that I need to do
Dim types = From loadedTypes In db.TableB Where loadedTypes.moduleID.Equals(ModuleId) Select loadedTypes.loadtype.Split(",")
which produces a string type of each value in TableB.LoadTypes. So now I would have a for loop for ChkBox.Items(types).Selected = True. But how do I convert my variable 'types' from the string to an integer?