Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Large dropDownList slow in UpdatePanel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Don - 01 Feb 2008 16:09 GMT
I have a large DropDownList that is very slow when it's in an
UpdatePanel.  The initial loading of the page is not slow, only the
PostBack is slow.  When I do not use the UpdatePanel PostBacks are
very fast.  I have EnableViewState set to false for this DropDownBox.

Using the debugger I see that the Code Behind is entered quickly.  The
slowdown happens sometime after OnUnload occurs.  I think it happens
when refreshing the page.

To duplicate the problem create a page with a ScriptManager and
UpdatePanel.  Add a DropDownList and Button to the UpdatePanel.  Here
is the code:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
   <title>Untitled Page</title>
</head>
<body>
   <form id="form1" runat="server">
   <div>
       <asp:ScriptManager ID="ScriptManager1" runat="server">
       </asp:ScriptManager>
       <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <ContentTemplate>
               &nbsp;
               <asp:DropDownList ID="DropDownList1" runat="server"
EnableViewState="False">
               </asp:DropDownList>
               <asp:Button ID="Button1" runat="server" Text="Button" /

           </ContentTemplate>
       </asp:UpdatePanel>
   </div>
   </form>
</body>
</html>

In Page_load add the code below to add 6,000 rows to the DropDownList:
   protected void Page_Load(object sender, EventArgs e)
   {
       DropDownList1.Items.Clear();
       for (int i = 0; i < 6000; i++)
       {
           DropDownList1.Items.Add("A" + i);
       }
   }

Run the page and click the button.  The PostBack is very slow - about
35 seconds.
Now move the Button outside of the UpdatePanel.  This causes the
entire page to refresh when a PostBack is performed.  This takes about
2 seconds.
Peter Bromberg [C# MVP] - 01 Feb 2008 16:20 GMT
The only response I can give is that the UpdatePanel is having to use XmlHttp
to marshal a large amount of "string-ified" data over the wire and reassemble
it in the callback to fit your control's needs. There are some situations
where AJAX just doesn't "fit" and this is probably one of them. Either that,
or don't bring back so much data at one time.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com 

> I have a large DropDownList that is very slow when it's in an
> UpdatePanel.  The initial loading of the page is not slow, only the
[quoted text clipped - 47 lines]
> entire page to refresh when a PostBack is performed.  This takes about
> 2 seconds.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.