X
xzzy
In code behind, I can iterate thru the items in a ListBox if it is like this
in the aspx page:
<asp:listbox id="ctlLB" runat="server" selectionmode="single">
<asp:listitem value="0">First item</asp:listitem>
<asp:listitem value="1">Second item</asp:listitem>
<asp:listitem value="2">Third item</asp:listitem>
</asp:listitem>
But if it is the following in the aspx page, and I databind in code behind,
then even though the items are properly listed in the listbox and the
correct item is selected, ctlLB.Items.Count is always == 0 and thus I am
unable to iterate thru the items collection ( to store the selected item's
value back to the DB ).
<asp:listbox id="ctlLB" runat="server" selectionmode="single">
</asp:listitem>
or
<asp:listbox id="ctlLB" runat="server" selectionmode="Multiple">
</asp:listitem>
Argh! what am I doing wrong?
Thank you for your help!
in the aspx page:
<asp:listbox id="ctlLB" runat="server" selectionmode="single">
<asp:listitem value="0">First item</asp:listitem>
<asp:listitem value="1">Second item</asp:listitem>
<asp:listitem value="2">Third item</asp:listitem>
</asp:listitem>
But if it is the following in the aspx page, and I databind in code behind,
then even though the items are properly listed in the listbox and the
correct item is selected, ctlLB.Items.Count is always == 0 and thus I am
unable to iterate thru the items collection ( to store the selected item's
value back to the DB ).
<asp:listbox id="ctlLB" runat="server" selectionmode="single">
</asp:listitem>
or
<asp:listbox id="ctlLB" runat="server" selectionmode="Multiple">
</asp:listitem>
Argh! what am I doing wrong?
Thank you for your help!