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

Grid Does not update

13 Answers 203 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Laura Edwards
Top achievements
Rank 1
Laura Edwards asked on 12 Aug 2010, 04:40 PM
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?

13 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 13 Aug 2010, 09:49 AM
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
0
Laura Edwards
Top achievements
Rank 1
answered on 13 Aug 2010, 02:35 PM
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.
0
Nedyalko Nikolov
Telerik team
answered on 16 Aug 2010, 12:35 PM
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
0
Laura Edwards
Top achievements
Rank 1
answered on 16 Aug 2010, 02:05 PM
Yes it is bound to an Observable collection.
0
Nedyalko Nikolov
Telerik team
answered on 17 Aug 2010, 03:35 PM
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
0
Laura Edwards
Top achievements
Rank 1
answered on 17 Aug 2010, 04:08 PM
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?
0
Nedyalko Nikolov
Telerik team
answered on 18 Aug 2010, 07:17 AM
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
0
Laura Edwards
Top achievements
Rank 1
answered on 18 Aug 2010, 01:39 PM
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);
}
0
Nedyalko Nikolov
Telerik team
answered on 19 Aug 2010, 01:20 PM
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
0
Laura Edwards
Top achievements
Rank 1
answered on 19 Aug 2010, 02:02 PM
Thank you for your answer. Could you give me an example? I've tried and the collection doesn't reflect the changes still.
0
Nedyalko Nikolov
Telerik team
answered on 26 Aug 2010, 12:36 PM
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
0
Carl
Top achievements
Rank 1
answered on 22 Sep 2010, 04:06 AM
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.
0
Vlad
Telerik team
answered on 27 Sep 2010, 12:58 PM
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
Tags
GridView
Asked by
Laura Edwards
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Laura Edwards
Top achievements
Rank 1
Carl
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or