Grid Does not update

14 posts, 0 answers
  1. Laura Edwards
    Laura Edwards avatar
    25 posts
    Member since:
    Jun 2010

    Posted 12 Aug 2010 Link to this post

    I have a gridview that is bound to the pagedSource of an attached data pager. The data pager is bound to an observable collection that is the result of a WPF service call.

    I delete rows by calling another service in a radwindow. My problem is that the grid view does not refresh when the service call is made, on a button command in the window. I know that the service call works, because if I manually refresh the page, the row is gone.

    Why is the grid not refreshing?
  2. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 13 Aug 2010 Link to this post

    Hello Laura Edwards,

    This is a known issue and you could check this forum thread for more information.
    Sorry for the inconvenience caused.

    All the best,
    Nedyalko Nikolov
    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. Laura Edwards
    Laura Edwards avatar
    25 posts
    Member since:
    Jun 2010

    Posted 13 Aug 2010 Link to this post

    My issue is still occuring even if I do not have the pager in there.

    Here is the code for my grid:
    <telerik:RadGridView Grid.Column="1" Grid.Row="1" x:Name="CategoryManagementGrid" IsReadOnly="True" AutoGenerateColumns="False" SelectionMode="Single"
                                 CanUserFreezeColumns="False" Width="900" Height="590" ItemsSource="{Binding Categories, Mode=OneWay}">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewSelectColumn />
                        <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding Id}"/>
                        <telerik:GridViewDataColumn Header="Tag Category" DataMemberBinding="{Binding Name}" UniqueName="CategoryName" IsResizable="False" Width="500"/>
                        <telerik:GridViewDataColumn Header="Number of Tags in Category" DataMemberBinding="{Binding TagCount}" UniqueName="NumberTagCategory" HeaderTextAlignment="Left"></telerik:GridViewDataColumn>
                        <telerik:GridViewColumn>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadButton x:Name="tagEditButton" Content="Edit" Click="categoryEditButton_Clicked"/>
                                  
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>
                    <telerik:GridViewColumn>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadButton Content="Delete" Click="categoryDeleteButton_Click" />
                                      
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>

    When I delete an item in the collection from the rad window, when I close the rad window the grid view does not update to the updated collection.
  5. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 16 Aug 2010 Link to this post

    Hi Laura Edwards,

    If RadGridView is bound to a collection that does not implement INotifyCollectionChanged, there is no way to update its contents after any CRUD operation.
    Could you confirm that RadGridView is bound to a data source (Categories) that implements INotifyCollectionChanged (ObservableCollection<T> for example)?

    All the best,
    Nedyalko Nikolov
    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
  6. Laura Edwards
    Laura Edwards avatar
    25 posts
    Member since:
    Jun 2010

    Posted 16 Aug 2010 Link to this post

    Yes it is bound to an Observable collection.
  7. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 17 Aug 2010 Link to this post

    Hi Laura Edwards,

    I cannot figure out what is going on without any further information.
    Could you please open a support ticket and send me a sample application which I can debug on my side?
    Thank you in advance.

    All the best,
    Nedyalko Nikolov
    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
  8. Laura Edwards
    Laura Edwards avatar
    25 posts
    Member since:
    Jun 2010

    Posted 17 Aug 2010 Link to this post

    I don't know if I can. The collection that the grid is bound to is the result of a service call to one of our WCF services. Could the issue be that the updating of the collection (say deleting a category) happens in a rad window?
  9. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 18 Aug 2010 Link to this post

    Hi Laura Edwards,

    From where are you deleting a category from RadGridView.Items, from the collection which is a result of a service call or from the underlying database? If RadGridView is not updated I suppose that you are deleting an item from the database and the result collection is not updated. Could you please at least share some code snippets?

    P.S. I think that RadWindow has no relation to this problem.

    Sincerely yours,
    Nedyalko Nikolov
    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
  10. Laura Edwards
    Laura Edwards avatar
    25 posts
    Member since:
    Jun 2010

    Posted 18 Aug 2010 Link to this post

    I use a command on a button in the window to open up another service call that deletes the item from the database. How would I let the collection know that it changed via the service call so that the grid updates?

    Here is a snippet of the code I use to delete an item.
    #region Delete Tags
    void TagToDelete(object param)
    {
        TagManagement.Tags.Tag deleteTag = new TagManagement.Tags.Tag();
        deleteTag.Name = param.ToString();
          
        var xid = from x in Tags where deleteTag.Name == x.Name select new { x.Name, x.Id };
        foreach (var p in xid)
        {
            DeletionTag.Id = p.Id;
            DeletionTag.Name = p.Name;
        }
        RadWindow.Confirm("Are you sure you want to delete this tag?", this.OnClosed);
    }        
    private void OnClosed(object sender, WindowClosedEventArgs e)
    {
        if (e.DialogResult == true)
        {
            categoryClient.DeleteTagAsync(DeletionTag.Id);
            categoryClient.DeleteTagCompleted += new EventHandler<AsyncCompletedEventArgs>(categoryClient_DeleteTagCompleted);
        }
    }
    void categoryClient_DeleteTagCompleted(object sender, AsyncCompletedEventArgs e)
    {
        ResponseHandler(true);
    }
  11. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 19 Aug 2010 Link to this post

    Hello Laura Edwards,

    In that case you have to rebind RadGridView data source. By rebind I mean to get the item source again by the WCF service method call.
    I hope that will help.

    Best wishes,
    Nedyalko Nikolov
    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
  12. Laura Edwards
    Laura Edwards avatar
    25 posts
    Member since:
    Jun 2010

    Posted 19 Aug 2010 Link to this post

    Thank you for your answer. Could you give me an example? I've tried and the collection doesn't reflect the changes still.
  13. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 26 Aug 2010 Link to this post

    Hello Laura Edwards,

    Sorry for the late answer.
    Generally I think that the best approach is to delete items via RadGridView built-in mechanism (e.g. via Delete key), and then update status of the underlying data source. I'm attaching an example which uses WCF Data service that demonstrates this approach. For more information about WCF Data services you can take a look at this link.

    Sincerely yours,
    Nedyalko Nikolov
    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
  14. Carl
    Carl avatar
    195 posts
    Member since:
    Oct 2012

    Posted 21 Sep 2010 Link to this post

    Could you please continue and enhance the Northwind demo for Silverlight GridView and WCF Data Services by rebuilding it so that

    1) it references the live Microsoft OData service for Northwind at

    http://services.odata.org/Northwind/Northwind.svc/

    2) it demonstrates multi-level hierarchical grids that show the proper techniques to use to dynamically load data in a detail grid when a row is selected in the parent master grid

    Thanks for updating and enhancing this demo. Some discussion of the Silverlight XAML and code-behind for multi-level hierarchical grids with OData services would be appreciated. There needs to be much better documentation on these things.
  15. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 Sep 2010 Link to this post

    Hello,

     I've attached an example application demonstrating this. 

    Best wishes,
    Vlad
    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
Back to Top
DevCraft banner