Paging radgrid telerik table that contains parent and child in C#

2 posts, 1 answers
  1. Daniel
    Daniel avatar
    5 posts
    Member since:
    Mar 2011

    Posted 08 Aug 2014 Link to this post

    How to have multiple VirtualItemCount in radgrid? In my radgrid table that have a hierarchy structure. It has a parent and child and child below child. I want paging in radgrid differ based on the level. I am already paging the parent, but the problem is the child paging also follow the parent page. Example:

    Image below shows that POST contains 8 items and has 2 pages. It is correct, but the COMMENTS's paging also follow the post one. It is wrong. Actually the comments for that post only contain 2 items and the page for comment should have only one.'To calculate the total items of post by this code:
     protected void countData()
    string sql = "SELECT * FROM VIEW_POST";
    DataTable dtTotalData;
    objDBInterface.strConn = mag.ConnStr();
    dtTotalData = objDBInterface.getResults(sql);
    totalDataIs = dtTotalData.Rows.Count.ToString();
    VirtualItemCount = Convert.ToInt16(totalDataIs.ToString());
    pageNeeded = Convert.ToInt16(totalDataIs) / FBGrid.PageSize;
    And set the radgrid VirtualItemCount by this code on page load:
    FBGrid.VirtualItemCount = VirtualItemCount;

    Please anybody help me how to handle this situation. Thanks in advance.
  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    2084 posts

    Posted 12 Aug 2014 Link to this post

    Hello Daniel,

    Although the provided information is not sufficient enough, please note that if you are using DetailTables for the hierarchy, in order to get the pagers to work correctly you need to set the VirtualItemCount (and the other related to the custom paging properties) for the TableViews (MasterTableView and GridTableView) and not for the grid. This will allow you to specify different values to each table view.

    If the above does not help, please elaborate on your exact scenario and how you are creating your hierarchy.

    Konstantin Dikov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top