mardi 18 octobre 2016

Vb.net create checkbox items from comma delimited string

I have a simple ASP checkbox list (see bellow):

   <asp:CheckBoxList ID="CheckBoxList1" runat="server">
                </asp:CheckBoxList>

I have a string in my vb.net (see bellow):

"1,2,3,4,5,6,7,8,9,10"

I want to be able to loop through each number in my string and add each one as a checkbox in my checkbox list. I have searched online though most solutions I have come across seem slightly different from what I want to achieve.

This is the code I have so far:

   For Each s In checkBoxString.split(",")
        Next

I was wondering if anyone could give me any suggestions to how I can achieve this. Any help is appreciated, Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire