Self Referencing Hierarchy Paging

10 posts, 0 answers
  1. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 16 Feb 2009 Link to this post

    I am using a self-referencing hierarchy with paging (nothing custom, just the built-in mechanisms). When I expand a parent item to show the children, the grid shows the parent's paging template inside it which is something I would rather not have happen. Is it possible to hide this on child records?
  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 18 Feb 2009 Link to this post

    Hi digitall,

    Have you set the PageSize property for the whole grid? If so, try setting it only for the MasterTableView in the mark-up for the page.

    This should resolve the issue.

    Regards,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 18 Feb 2009 Link to this post

    It looked promising, but ended up not working. The paging for each item underneath would show "1 of 11 pages" despite there not being enough data to account for that. It was on every child record too, not just some of them. Also, when I tried going to the next page on the "master" view the child records stopped showing up and it wasn't displaying the number of records I specified (25), but instead 3. I reverted back to a page size of 75 for the whole grid and paging functionality returned.
  5. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 19 Feb 2009 Link to this post

    Hi digitall,

    You are right.  RadGrid does not support paging with a self-referencing hierarchy when bound to a DataSource in mark-up. You have to wire up an event handler to the NeedDataSource event and assign the datasource in it. For instance, my example has to be reworked as follows:

    1. Remove the DataSourceID="SqlDataSource1" from the aspx mark-up of the grid.

    2. In the NeedDataSource event handler add the following code:

    RadGrid1.DataSource = SqlDataSource1.Select(new DataSourceSelectArguments()); 

    Hope this helps.


    Best regards,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 19 Feb 2009 Link to this post

    Actually, I am already using the NeedDataSource event handler which calls a method that returns a data table. I am talking directly to Oracle on this so the only easy way to deal with it was through code directly.

    Paging itself works fine, it's just that the child items all retain the paging information from the parent instead of having their own individual paging mechanisms which looks really odd when you expand a couple of child items. The paging is basically stacking on top of each other, but don't reference the appropriate rows. I might be able to post a screenshot if that didn't make sense but I would need to confirm with my bosses that it is OK to do so first.

    Any other thoughts?
  7. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 19 Feb 2009 Link to this post

    Hello digitall,

    When a self-referencing hierarchy is used and you have set the AllowPaging and PageSize properties of the RadGrid, then the paging being enabled and the page size are inherited by the child tables, but the pages of the child tables should reference the correct items.  I am sending you a sample application demonstrating this. Please, use it for comparison. Perhaps, there is something different in you scenario.

    On the other hand, if you set the AllowPaging and PageSize properties of the MasterTableView only, then the child table will get no paging. You can check this by removing the properties from the RadGrid main mark-up and adding them to the mark-up for its MasterTableView.

    Screenshots, mark-up or code behind are welcome. Thank you.

    Ragards,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 19 Feb 2009 Link to this post

    How are you sending this to me? If by email I haven't received anything yet.
  9. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 20 Feb 2009 Link to this post

    Hello digitall,

    I am sorry, perhaps some some error occurred during the sending process.

    I am reattaching the sample.

    Ragards,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. Sunny
    Sunny avatar
    31 posts
    Member since:
    Aug 2009

    Posted 19 Oct 2009 Link to this post

    Tsvetoslav,

    I have downloaded the demo code (selfreferencing.rar: http://www.telerik.com/ClientsFiles/117820_selfreferencing.rar) and I facing an issue with paging. I am using the same code and to test paging I have added 10 more rows to the Employee table. 

    Issue: When I click Page 2 or 3, the row is collapsing.

    Is there any way I can solve it? Do you have any code sample?

    Thanks
  11. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 22 Oct 2009 Link to this post

    Hi TelNew,

    I have prepared a small sample that demonstrates how to persist the grid state using cookies. Of course, you can modify the sample to persist only the expanded/collapsed state of the items and to use a different persisting media such as a Hashtable or a Session variable

    Greetings,
    Tsvetoslav
    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
UI for ASP.NET Ajax is Ready for VS 2017