Results 1 to 2 of 2

Thread: Listbox problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    182

    Listbox problem

    I am binding xml data to a list box. It works fine and all the data is successfully added to the list box. However when the form is submitted and if i try to retrieve any vallue from the list box it gives me no value at all. It is always giving me the 0 index value.

    On the other hand if i manually put data in a list box as shown below without any data binding, i can retrieve the value. Can anyone please tell me what is the problem.

    <vbcode>
    <asp:ListBox ID="List"
    runat="server">

    <asp:ListItem>Item 1</asp:ListItem>
    <asp:ListItem>Item 2</asp:ListItem>
    <asp:ListItem>Item 3</asp:ListItem>
    <asp:ListItem>Item 4</asp:ListItem>

    </asp:ListBox>
    </vbcode>

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Listbox problem

    Make sure you rebind it every time, usually in the OnLoad event of the page.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width