| romork wrote: |
|
Hi everybody;
There is a checklist. When I run it with debugging, the return values from checklist are correct.But without debugging, although I check 3 things, only one of them return true.Why?
|
|
If you are referring to a CheckBoxList, are you looping thru the items or just checking the selected value of the entire list? If you check the selected value of the entire list it will, in my experience, return the first selected value only. This is an example:
aspx page HTML source;
<asp:CheckBoxList ID="cblMediaType" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" AutoPostBack="True"></asp:CheckBoxList>
VB code;
For iIndex = 0 To Me.cblMediaType.Items.Count - 1
If Me.cblMediaType.Items(iIndex).Selected = True Then
Me.lblYouSelected.Text = Me.lblYouSelected.Text & Me.cblMediaType.Items(iIndex).Value.ToString & ","
End If
Next
If, however you do this;
Me.cblMediaType.SelectedValue
You will get only the first selected value, even though a debug watch may show each of the selected values, the program only deals with one upon execution.
Or did I completely miss the problem you are having?