Browser hang for drop down list change update panel

Last post 07-06-2009 11:41 PM by mainiabhay. 5 replies.

Sort Posts:

  • Browser hang for drop down list change update panel

    10-07-2008, 11:10 AM
    • Member
      1 point Member
    • 77bridge
    • Member since 10-07-2008, 2:56 PM
    • Posts 5

    Hi *,

    I have a drop down list which is sitting inside an update panel.  The drop down list is set to auto-postback when the selected index is changed, but this action doesn't repopulate the list items (it just sets some other controls' properties).  I guess the list items are just persisted through the viewstate.  Also, during the update panel refresh I display an animated gif progress bar.

    The ddl populates without problem initially, but I get into trouble when I change the selected index. Ultimately, it leads to the browser hanging (so much that the animated gif just becomes still for about 15min).  I've traced through all server behavior on the partial postback and it seems to execute this pretty quickly.  Also, I can comment out all the server event handling code and I get the same result.

     If I remove the update panel, everything works fine.  I guess it must be some client side wierdness.

     (also has the same results for IE6 and 7)

     Any suggestions?

     Thanks!

  • Re: Browser hang for drop down list change update panel

    10-07-2008, 12:27 PM
    • Member
      1 point Member
    • 77bridge
    • Member since 10-07-2008, 2:56 PM
    • Posts 5

     One additional note which might be interesting:

     this drop down populates with 15,000 list items.  If I cut the list to 2 list items, then I no longer see my problem.  So, it's not surprising that the size of the data is impacting the performance.  The big question for me is why would it take so much longer to repopulate the drop down list on a partial page refresh than a full page refresh (since view state should be persisting them in both cases)?

    Thanks!

  • Re: Browser hang for drop down list change update panel

    10-10-2008, 1:35 AM
    Answer
    Hi 77bridge
     
    I have reproduced the facing issue on our lab and just as you description, it made a high CPU usage, and browser hang for a long time.
     
    That might cause by the internal functioning mechanism of UpdatePanel, in your scenario, I would like to suggest you try to register your DropDownList as a PostBackTrigger, and then, it will trigger the normal Postback, which spend less time.
     
    The demo code is following:
     
      
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                for (int i = 0; i < 15000; i++)
                {
                    ListItem a = new ListItem(i.ToString(), i.ToString());
                    this.DropDownList1.Items.Add(a);
                    this.DropDownList2.Items.Add(a);
                }
            }
        }
    
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.TextBox1.Text = DateTime.Now.ToLongTimeString();
        }
    
        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.TextBox1.Text = DateTime.Now.ToLongTimeString();
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            <br />
        </div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
                    OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="DropDownList2_SelectedIndexChanged">
                </asp:DropDownList>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="DropDownList1" />
            </Triggers>
        </asp:UpdatePanel>
        </form>
    </body>
    </html>
    
     

     
    If I’ve misunderstood the facing problem, please feel free to let me know.
     
    Thanks.

     

    Lance Zhang
  • Re: Browser hang for drop down list change update panel

    04-18-2009, 7:54 AM
    • Member
      22 point Member
    • sreekumarp
    • Member since 02-06-2009, 3:13 PM
    • Posts 14

     I am also facing this problem.

    I have tried ur sugession.But this is causing a whole page postback in page.

    Just see my code and plz help me.

     


    Sreekumar P
    --------------------------------------------------
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: Browser hang for drop down list change update panel

    04-27-2009, 9:18 AM
    • Member
      4 point Member
    • Tarak
    • Member since 05-10-2007, 11:56 AM
    • Posts 3

    Hi Lance Zhang,

    It has been a really nice solution provided by you as a "PostBackTrigger".

    But I would be glad if the problem of Entire Page Refresh can also be resolved using any of the control of AJAX Extension.

    On using UpdatePanel too do not resolve the Page Refresh issue.

    Let me know for any query.

    Thanks in advance

    Tarak

     

     

  • Re: Browser hang for drop down list change update panel

    07-06-2009, 11:41 PM
    • Member
      4 point Member
    • mainiabhay
    • Member since 09-23-2008, 4:21 PM
    • Itasca,US
    • Posts 4

    Thanks Lance for this solution, it worked great.

    Tarak, As per my knowledge you cannot get rid of flicker of screen during post back.

    This shows that updatepanel is not appropriate in all cases, this may be considered as drawback of AJAX, but its true.

    To overcome this problem you might want to use .ASMX (web services) for details please click below

    http://msdn.microsoft.com/en-us/magazine/cc163413.aspx

    Thanks.

     

    abhay maini
Page 1 of 1 (6 items)