This is a migrated thread and some comments may be shown as answers.

Self Referencing Hierarchy Paging

9 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
digitall
Top achievements
Rank 1
digitall asked on 16 Feb 2009, 09:47 PM
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?

9 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 18 Feb 2009, 01:27 PM
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.
0
digitall
Top achievements
Rank 1
answered on 18 Feb 2009, 02:25 PM
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.
0
Tsvetoslav
Telerik team
answered on 19 Feb 2009, 12:01 PM
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.
0
digitall
Top achievements
Rank 1
answered on 19 Feb 2009, 01:26 PM
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?
0
Tsvetoslav
Telerik team
answered on 19 Feb 2009, 04:35 PM
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.
0
digitall
Top achievements
Rank 1
answered on 19 Feb 2009, 09:39 PM
How are you sending this to me? If by email I haven't received anything yet.
0
Tsvetoslav
Telerik team
answered on 20 Feb 2009, 10:55 AM
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.
0
Sunny
Top achievements
Rank 1
answered on 19 Oct 2009, 08:10 PM
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
0
Tsvetoslav
Telerik team
answered on 22 Oct 2009, 08:57 AM
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.
Tags
Grid
Asked by
digitall
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
digitall
Top achievements
Rank 1
Sunny
Top achievements
Rank 1
Share this question
or