GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

Last post 06-17-2008 9:13 AM by commadercody. 8 replies.

Sort Posts:

  • GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-12-2008, 2:19 PM
    • Member
      190 point Member
    • commadercody
    • Member since 03-21-2007, 10:23 AM
    • Posts 332

    I have a GridView which is inside an update panel that returns data from an ORACLE stored procedure.  The stored procedure in PL/SQL developer takes 2 seconds to return data, when I have it in the Update Panel filling the GridView it takes 20 seconds, 18 seconds without the update panel. 

    It is using a DataTable object to bind to the grid.  What do you think is causing such latency?  I have debug=false in the web.config but this has me quite confused.  Confused

    "From my point of view, the Jedi are evil!"
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-12-2008, 6:27 PM
    • Member
      407 point Member
    • mattbriggs
    • Member since 06-02-2008, 8:47 PM
    • Posts 73

    Does it return a lot of data? GridView stores the entire dataset in the ViewState, on big query you can end up with a ton of page bloat.

    Please remember to Mark As Answered if this post has answered your question
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-12-2008, 6:51 PM
    • Member
      190 point Member
    • commadercody
    • Member since 03-21-2007, 10:23 AM
    • Posts 332

    47 rows is my largest result and debugging is false in my web.config, paging is set to 10.  The query returns results in 1-2 seconds in PL/SQL developer, but when I hook it to an ASP.NET page it takes 20-30 seconds and does not matter if I have an updatePanel or not!

    "From my point of view, the Jedi are evil!"
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-13-2008, 9:29 AM
    • Member
      407 point Member
    • mattbriggs
    • Member since 06-02-2008, 8:47 PM
    • Posts 73

    Check out the "__VIEWSTATE" hidden field though. If they are big objects, you could still be talking about a 150k page, even if you wouldn't think it would be that big.

     

    Please remember to Mark As Answered if this post has answered your question
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-13-2008, 9:35 AM
    • Member
      190 point Member
    • commadercody
    • Member since 03-21-2007, 10:23 AM
    • Posts 332

    How do I access that?  I also dump my results into a ViewState["DataTableSearchResults"]  

    The reason I put the results in ViewState is because I have a search screen with different criteria.  I also have paging and sorting enabled and if I don't put it in ViewState I loose the data.   

    "From my point of view, the Jedi are evil!"
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-13-2008, 9:51 AM
    • Member
      407 point Member
    • mattbriggs
    • Member since 06-02-2008, 8:47 PM
    • Posts 73

    View page source on the rendered page.

     

    I'm almost positive thats where your perf issues are coming from. The ViewState works by serializing/encoding its contents and sticking them on a hidden field. Both Partial and Full page postbacks will push the viewstate over the wire in both directions.

    There are a bunch of places you can store stuff in asp, each has its pro's and con's. First thing though is are you using the automagical (like editing) stuff in your grid, or is it  display only? If it is display only, stick EnableViewState="False" in it, that will make a big difference.

    As for the search results,  If it is  something  that will be the same for everyone  (not based on dynamic criteria), I would stick it in the cache object. If it is the results of a search screen, I would probably use the session, not the view state. Filling up the session is still not that great, as it is in-proc memory for each active user, but in this case it is probably a better then serializing to the page. General rule of thumb is ViewState for smaller things, Session for bigger things (not quite that simple, but it is better then just viewstate for everything)

     

    Please remember to Mark As Answered if this post has answered your question
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-13-2008, 3:53 PM
    • Member
      190 point Member
    • commadercody
    • Member since 03-21-2007, 10:23 AM
    • Posts 332

    I really can't cache this because there are so many different variables in the search criteria it would almost be a new search everytime anyway.

    "From my point of view, the Jedi are evil!"
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-16-2008, 11:00 PM
    Answer

    Hi commadercody,

    First you can disable ViewState. Second you can use custom paging stored procedure which means it returns only one page data (in your case it is 10 records) at one time.

    Here is an article about it: http://www.dotnetjunkies.ddj.com/Article/975BE770-E5DC-4610-870B-A82BDB9B8845.dcik

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Thanks,
    Qin Dian Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: GridView in Update Panel SLOOOOOWWWWWWWWWW!!!!!!!!!!!

    06-17-2008, 9:13 AM
    Answer
    • Member
      190 point Member
    • commadercody
    • Member since 03-21-2007, 10:23 AM
    • Posts 332
    Qin, Thanks for the response.  I found out that my Oracle Client was the culprit.
    "From my point of view, the Jedi are evil!"
Page 1 of 1 (9 items)