CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Location
    Las Vegas
    Posts
    539

    Lightbulb DropDownList is losing state when using an UpdatePanel

    Dear Gurus,

    I have an UpdatePanel with a DropDownList
    (AutoPostBack="true")

    Its being triggered in the UpdatePanel like this
    <AJAX:AsyncPostBackTriggerControlID="_benefitGroup"EventName="SelectedIndexChanged"/>

    The problem is that every refresh to the page causes the drop down to lose it's state,

    How can I make it remember the last selection state without using the session ?

    (what is wrong with the ViewState / UpdatePanel ?)
    Best Regards - Yovav

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: DropDownList is losing state when using an UpdatePanel

    It depends on how you fill your drop down list with data. Try avoid changing the drop down during postbacks:
    Code:
    If (Not Page.IsPostBack) Then
        DropDownList1.Items.Add("a")
        DropDownList1.Items.Add("b")
        DropDownList1.Items.Add("c")
        DropDownList1.Items.Add("d")
    End If
    - petter

Tags for this Thread

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

Featured