You should really try to avoid programming ASP.Net in the old ASP style (script embedded in the HTML). If you want to add checkbox items to the page dynamically, you should do so in the code section of your page (either the runat server script tag or in the code-behind depending on what method you are using.
Using either method, here's my recommendation (put this in your code section's page_load function):
For i = 0 To firstarr.Count - 1
For j = 0 To secondarr.Count - 1
If Trim(firstarr.Item(i)) = Trim(secondarr.Item(j)) Then
flag = True
Exit For
End If
Next
objCheckBox = New CheckBox
objCheckBox.Checked = flag
objCheckBox.ID = "firstarr" & i
Me.Controls.Add(objCheckBox)
flag = False
Next
You might want to put an asp:Placeholder in your page where you want to put the checkboxes, then use that instead of "Me" in the code above.
Peter
|