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

Binding with RIA Service not working

5 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Albert
Top achievements
Rank 1
Albert asked on 25 Oct 2010, 01:31 PM
Hello Friends ,

I am using Wcf Ria Service to Bind grid.Suppose in my table only 1 recode is there.If I use following code to bind grid ,then it shows only 1 blank row.Data is not being display right now.

And if i set auto generate column to true and remove all columns from <telerik:RadGridView.Columns/> collection,then after bind 1 row display properly with all data.

XAML Code :
<telerik:RadGridView Grid.Column="1"  RowIndicatorVisibility="Collapsed" IsReadOnly="True"
                                   CanUserFreezeColumns="False"    RowDetailsVisibilityMode="Visible"
                         CanUserResizeColumns="False"  x:Name="grdUsre" AutoGenerateColumns="True">
                   <telerik:RadGridView.Columns>
                       <telerik:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding Path=FirstName}"/>
                       <telerik:GridViewDataColumn Header="Last Name" DataMemberBinding="{Binding LastName}" />                      
                   </telerik:RadGridView.Columns>
               </telerik:RadGridView>

Code to Bind Grid :

TaskContext objTaskContext = new TaskContext();
           grdUsre.ItemsSource = objTaskContext.Users;           
           objTaskContext.Load(objTaskContext.GetUsersQuery());

Can anyone tell me how to solve this ?

-Thanks

5 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 27 Oct 2010, 04:02 PM
Hi Albert,

Everything seems to work fine. Please find attached a sample project. Just change the name of your sql express instance in the web.config file.


Greetings,
Veselin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daniel Morgenthaler
Top achievements
Rank 2
answered on 17 Nov 2010, 10:03 AM
Hi Veselin

The sample works fin if we only want to display data in the grid. But no Insert or Delete is possible with this solution.

 

In the documentation under http://www.telerik.com/help/silverlight/gridview-configuring-the-databindings.html you describe that the ItemsSource must be bund t a collection that implements INotifyCollectionChanged. The Customers in your sample is of type EntitySet<Customer> which implements INotifyCollectionChanged.

 

Why I can’t insert or delete records?

 

Thanks and have a nice day.

 

Daniel

0
Vlad
Telerik team
answered on 17 Nov 2010, 10:08 AM
Hello,

 You cannot do this since the collection bound to the grid is not even IList. My suggestion is to use DomainDataSource to achieve your goal. 

Sincerely yours,
Vlad
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Daniel Morgenthaler
Top achievements
Rank 2
answered on 17 Nov 2010, 10:18 AM
Thanks for this. Can you show us how you do this in your sample?
0
Vlad
Telerik team
answered on 17 Nov 2010, 10:26 AM
Hello,

 You just need to bind the grid using DomainDataSource and call SubmitChanges() when you want to submit changes to the server-side. 

Sincerely yours,
Vlad
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
Tags
GridView
Asked by
Albert
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Daniel Morgenthaler
Top achievements
Rank 2
Vlad
Telerik team
Share this question
or