lazy loading grid in panelitem

4 posts, 0 answers
  1. Mario
    Mario avatar
    75 posts
    Member since:
    Jun 2009

    Posted 27 Nov 2009 Link to this post


    i have an approach to make my profile.aspx page faster. That page includes a panelbar with 6 different panelitems, each containing at least one grid gathering information from the database. I thought to make the page faster. i dont query the database for the grids and hold all panelitems collapsed except of the top/first panelitem.

    so if the user wants to see the information of a panelitem, following mechanic comes into play:

    the grid in the panelitem is still created in and configured as stated in my aspx code file. It just gets no DataSource:

    protected void RadGridRelations_NeedDatasource(object source, GridNeedDataSourceEventArgs e) 
                RadPanelItem panelItem = panelBarProfile.FindItemByValue("relations"); 
                if (panelItem.Expanded) 
                    RadGrid radGrid = source as RadGrid; 
                    radGrid.DataSource = BLDocument.GetAllRelatedDocumentsMultipleTimes(, _userId); 
                    radGrid.MasterTableView.NoMasterRecordsText = LanguageHelper.GetText("noRelationsText"); 

    the grid is only allowed to load the data from the database if the panelitem got expanded.

    hint: dont forget to ajaxify the panelbar and the grid.

    another feature is that if the panelitem gets collapsed and expanded it gets the data from server again so its uptodate.

    how u find it? please tell me if thats a good approach.

    thx, mario
  2. Vesko
    Vesko avatar
    122 posts
    Member since:
    Mar 2009

    Posted 01 Dec 2009 Link to this post

    Hi Mario,

    the approach seems quite good to me. Thank you for posting it.
  3. DevCraft R3 2016 release webinar banner
  4. Mario
    Mario avatar
    75 posts
    Member since:
    Jun 2009

    Posted 02 Dec 2009 Link to this post


    but theres a problem and i dont yet know if i its tolerable.. when u click the panelitem to expand the browser jumps to the top of the page. When its finished processing/loading it jumps back to the place the panelitem is placed.

    dont think thats a neat behavoir ..
  5. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 04 Dec 2009 Link to this post

    Hello Mario,

    I think the best way to proceed is to send us a sample running page (in a support ticket) and we will give you a solution.

    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top