Binding with RIA Service not working

6 posts, 0 answers
  1. Albert
    Albert avatar
    36 posts
    Member since:
    May 2010

    Posted 25 Oct 2010 Link to this post

    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
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 27 Oct 2010 Link to this post

    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
  3. DevCraft banner
  4. Daniel Morgenthaler
    Daniel Morgenthaler avatar
    3 posts
    Member since:
    Jul 2004

    Posted 17 Nov 2010 Link to this post

    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

  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 17 Nov 2010 Link to this post

    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>>
  6. Daniel Morgenthaler
    Daniel Morgenthaler avatar
    3 posts
    Member since:
    Jul 2004

    Posted 17 Nov 2010 Link to this post

    Thanks for this. Can you show us how you do this in your sample?
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 17 Nov 2010 Link to this post

    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>>
Back to Top
DevCraft banner