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

Rebinding / Updating while maintaining selection, position, expansion

7 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 26 May 2009, 02:37 PM
Hi All,

I'm investigating Silverlight for the next revision of the product.  I'm generally quite happy with the ASP.NET Ajax controls.  One of the biggest pain points though is handling (near) real-time updates of data in RadGrid / GridView.  Right now (using the ASP.NET Ajax controls), we rebind on a manual refresh, initiated by the user, as the rebind loses the expanded detail view(s), the row selection, etc.  A quick examination by a colleague indicates this remains true with the GridView control in Silverlight.

The behavior we want is similar to the Windows Explorer or the Task Manager - where you can select one or more items, change the sort order, etc., and not lose either while at the same time objects (files, process, tasks, etc.) can come and go and the view updates in (near) real-time.

Anyone have any suggestions for achieving this goal?  Of course a built-in option would be best... I'd rather not keep a second, hidden grid from which I could use JS to update only individual cells, assuming that is even possible.  This approach sounds like it may slow things down even more.

I'll cross-post this to the Silverlight GridView forum as well.

Thank you,
Tim

7 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 29 May 2009, 09:49 AM
Hello Tim,

I think that the sample code snippets from the resources pointed below will help you retain the expanded/selected items states in flat or hierarchical grid:

http://www.telerik.com/community/code-library/aspnet-ajax/grid/retain-expanded-selected-state-in-hierarchy-on-rebind.aspx

http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html
http://www.telerik.com/help/aspnet-ajax/grdpersistselectedrowsonsorting.html

Feel free to alter/enhance the solutions presented there to be in conformance with your project schema.

Kind regards,
Sebastian
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
Tim
Top achievements
Rank 1
answered on 29 May 2009, 12:19 PM
Thank you, Sebastian.  This was the answer I was 'afraid of'.  I was hoping there was an automatic way for this to take place.

Do you have any way to do the same for Silverlight?  (Please answer in my cross-post in the Silverlight RadGrid forum)

Tim

0
Sebastian
Telerik team
answered on 29 May 2009, 12:24 PM

Hello Tim,

My colleagues from our Silvelight team will answer your question for RadGridView for Silverlight in the forum thread you opened with regards to this matter.

Best regards,

Sebastian
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
Bob
Top achievements
Rank 1
answered on 12 Oct 2009, 01:34 AM

Hi Sebastian ,

The solutions on your site work great but I can not figure how to capture when paging is fired.  This is because the same expanded row in the list stays expanded when I change pages within the grid.  Can you recommend how to know when the paging is fired and collapse all rows expanded?  Also the same collapse process when sorting or grouping changes?

Best Regards,

Bob

0
Sebastian
Telerik team
answered on 12 Oct 2009, 09:31 AM
Hello Bob,

You can detect whether paging, sorting or filtering operation has been triggered on the server intercepting the ItemCommand event of the grid and checking the e.CommandName argument value in the handler. This topic from the product documentation elaborates on this subject in greater details.

Best,
Sebastian
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.
0
Bob
Top achievements
Rank 1
answered on 13 Oct 2009, 01:25 AM
Hey Sebastian,

I read more indepth about the ItemCommand event which I came to realize that I am using the slider pager and when pages are changed it does not fire the ItemCommand event.  Once I change it to Next/Previous I was able to see the event triggered in ItemCommand.  I like the slider control but not sure how I can get it to trip the ItemCommand event, any direction I can go to turn on this event?

Best Regards,

Bob
0
Sebastian
Telerik team
answered on 13 Oct 2009, 08:10 AM
Hello Bob,

Indeed your observation is correct and the slider type pager does not fire the ItemCommand event of the grid by design. However, you can wire the OnPageIndexChanged event of the grid which will be raised when you change the active page using the slider.

Kind regards,
Sebastian
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
Tim
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Tim
Top achievements
Rank 1
Bob
Top achievements
Rank 1
Share this question
or