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

Refreshing GridView when a filter descriptor exists on DDS

1 Answer 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 05 Mar 2013, 05:42 PM
I've only been doing Silverlight for a couple months, so if there is a better way to do this, please let me know.

I have a gridview that I'm pulling from a SQL database (its a view that I created there).  Once a record is selected in the GV, I then populate a detail section on the screen.

DomainDataSource: CustomersGvSource - a SQL view as it pulls a variety of data from multiple tables
DomainDateSource: customerDetailSource (filter descriptor is based on selected customer from GV)

Once a customer is updated (their address changes or phone number or whatever else), then I save the changes without any problem.  My problem is that the GV doesn't reload.   I've tried using  '.Load' and '.Clear' on my GV, but since I have a filter descriptor on the DDS, I get an error notification about it.  How do I fix my code so that I don't have the error?  Should I remove the filter descriptor from the DDS and move it to the code-behind?

I've been looking at the forum to see if I could find an answer, but most of what I see is using MVVM.

I know this has to be something simple that I'm just missing.

Thank you for your assistance.
Brian.

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 06 Mar 2013, 09:18 AM
Hello,

Have you seen our solution for WCF RIA Services MVVM called QueryableDomainServiceCollectionView<T>?

Here is an online example which shows it in action. Here is a help topic explaining how to set it up.

The important thing to note is that when you bind a RadGridView to such a QDSCV, when you filter and sort the grid, it will automatically send this information to the QDSCV which in turn will perform the filtering and sorting directly on the server by using WCF RIA Services EntityQuery<T>. The QDSCV has two methods called SubmitChanges and RejectChanges. When you call one of them, it will tell the DomainContext to save or reject the changes on the server and data will be refreshed from the server automatically. RadGridView will automatically refresh since it listens for the events that the QDSCV is sending, i.e. CollectionChanged.

This QDSCV is in fact the internal view of our control called RadDomainDataSoureHere you can see all of its online examples for different scenarios. The QDSCV was made public so you can use it in MVVM scenarios inside your viewmodel without having to create an entire control in XAML.

I hope this helps.

All the best,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Brian
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or