I have two checkboxes. Depending on which one I check, a listbox will be filled with the appropriate data. I haven't been able to get it to work with the code I have, which is as follows:
.aspx file
.vb file
Sub SelectNumberOfUsers()
If chkCurrent.Checked = True Then
lstUsers.Items.Add("Item 1"
ElseIf chkAll.Checked = True Then
Dim intFirst As Integer
For intFirst = 1 To 10
lstUsers.Items.Add("Item " & intFirst)
Next
End If
End Sub
Essentially the listbox won't populate at all regardless of which box I check. >:-< Not sure what I'm doing wrong. Any ideas? JJ
"Ignorance and prejudice and fear walk hand in hand" - Witch Hunt, by Rush
.aspx file
Code:
<TR>
<TD><ASP:CHECKBOX autopostback="True" id="chkCurrent" runat="server" text="Users Currently Logged In"></ASP:CHECKBOX> </TD>
<TD><ASP:CHECKBOX autopostback="True" id="chkAll" runat="server" text="All Users Permitted Access"></ASP:CHECKBOX></TD>
</TR>
<TR>
<TD><ASP:LINKBUTTON id="lkbtnSelect" runat="server">Select All</ASP:LINKBUTTON></TD>
<TD colspan="2"><ASP:LINKBUTTON id="lkbtnUnselect" runat="server">Unselect All</ASP:LINKBUTTON></TD>
</TR>
<TR>
<TD><ASP:LISTBOX autopostback="True" id="lstUsers" rows="10" runat="server" selectionmode="Multiple" width="200px"></ASP:LISTBOX></TD>
<TD align="middle"><ASP:BUTTON id="btnAdd" onclick="AddToListClick" runat="server" text="Add →"></ASP:BUTTON><BR><BR><BR>
<ASP:BUTTON id="btnRemove" onclick="RemoveFrListClick" runat="server" text="← Remove"></ASP:BUTTON></TD>
<TD><ASP:LISTBOX autopostback="True" id="lstSelectUser" rows="10" runat="server" selectionmode="Single" width="200px"></ASP:LISTBOX></TD>
</TR>
Sub SelectNumberOfUsers()
If chkCurrent.Checked = True Then
lstUsers.Items.Add("Item 1"
ElseIf chkAll.Checked = True Then
Dim intFirst As Integer
For intFirst = 1 To 10
lstUsers.Items.Add("Item " & intFirst)
Next
End If
End Sub
Essentially the listbox won't populate at all regardless of which box I check. >:-< Not sure what I'm doing wrong. Any ideas? JJ
"Ignorance and prejudice and fear walk hand in hand" - Witch Hunt, by Rush