ASP.Net ListBox selections not working in Panel?

Posted by larryq on Stack Overflow See other posts from Stack Overflow or by larryq
Published on 2010-04-30T23:52:13Z Indexed on 2010/04/30 23:57 UTC
Read the original article Hit count: 307

Filed under:
|
|

Hi everyone,

I'm having trouble processing a listbox after selecting some items from it. In my markup, the listbox is contained within an asp:panel and is populated during page load in the codebehind. That part works fine.

It's when I select various items and submit that I have trouble. My handler loops through the listbox items but doesn't see any as being selected. I'm not sure why.

Here's the markup:

            <asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="ModalWindow">
            <table width="100%">
             <asp:label runat = "server">Choose your items</asp:label>

                <tr>
                    <td>
                        <asp:ListBox ID="lstFundList" runat="server" SelectionMode="Multiple" OnLoad="lstFundList_LoadData">

                        </asp:ListBox>
                    </td>
                </tr>
             </table>

             <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_OnClick"/>
             <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="$find('ModalPopupExtender1').hide(); return false;" />

           </asp:Panel>

In my btnUpdate_OnClick handler I can't see any listbox items that are marked as selected. I assume something strange is going on with respect to postback and the panel?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about postback