DropDownList not maintaining viewstate

Discussion in 'ASP .Net Web Controls' started by Carlos A. Manzanares, Nov 10, 2003.

  1. Hey all. I have an ASP.NET page using C#. In the page I have a
    DropDownList. I have the document "EnableViewState" set to TRUE. I have
    the DropDownList control "EnableViewState" set to TRUE.

    The DropDownList is populated when "Page.IsPostBack" is false.

    However, when the page is posted back, the DropDownList is empty. It is not
    maintaining it's viewstate and I can't find a reason for this to happen.

    Here is some code:

    In the ASPX page:
    <asp:DropDownList id="ddlGroup" runat="server" CssClass="textBox"
    Enabled="true" AutoPostBack="True"
    EnableViewState="true"></asp:DropDownList>

    The list is populated in the code-behind page with this method:

    My Page_Load contains:

    if (!Page.IsPostBack)
    {
    FillList();
    }

    The FillList() method just connects to the database to retrieve data and
    populate the DropDownList.
    Carlos A. Manzanares, Nov 10, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dinesh Upare
    Replies:
    0
    Views:
    399
    Dinesh Upare
    Jul 16, 2003
  2. sklett
    Replies:
    4
    Views:
    9,878
    sklett
    Apr 8, 2004
  3. Charlie@CBFC
    Replies:
    0
    Views:
    465
    Charlie@CBFC
    Apr 2, 2005
  4. Steve Murphy
    Replies:
    2
    Views:
    753
    =?Utf-8?B?Sm9l?=
    Jan 15, 2006
  5. Udit
    Replies:
    3
    Views:
    124
Loading...

Share This Page