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

Refresh problem?

5 Answers 257 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alwin
Top achievements
Rank 1
Alwin asked on 29 Aug 2011, 01:44 PM
Hi,

i converted a solution from Version 2011.1.11.419 to 2011.2.11.712 and now something with RadGrid.Refresh(); doesn't work as it does before.
Is this a known issue or should i call an other function?
I've got a context menu to manipulate the data of a column in multiple selected rows, after that i call Refresh() to show the new data. This worked fine in version 419...
The grid is bound to an EF-datasource, which is written to the DB in a separate function, after all modifications to the data are done.

The code looks like this:
if (this.grdEinheiten.SelectedRows.Count > 0)             
{                 
foreach (GridViewRowInfo row in grdEinheiten.SelectedRows)                 
{                     
if (row.DataBoundItem is ClientTableItem)                     
{                         
ClientTableItem item = (ClientTableItem)row.DataBoundItem;
switch (art)                         
{                             
case something:
item.Something = value;
break;                             


...
default:                                 
break;                         
}                         
}                 
}                 
this.grdEinheiten.Refresh();             
}

Best regards

5 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 01 Sep 2011, 08:40 AM
Hello Alwin,

Thank you for your question.

RadGridView automatically refreshes its data when the properties of its DataSource items are changed if these items notify the control for the changes. I was not able to reproduce the difference of the RadGridView's Refresh method behavior between the two versions of the control while testing with data, which does not implement the INotifyPropertyChanged interface.

RadGridView should synchronize the data it presents with its DataSource when you call the Update method of GridTableElement:
this.grdEinheiten.TableElement.Update(GridUINotifyAction.DataChanged);

I hope it helps.

Best regards,
Alexander
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Kyle
Top achievements
Rank 1
answered on 20 Sep 2011, 08:24 PM
For the life of me, I cannot get the grid to refresh when I add an object to the underlying datasource.

Using EF4, I am binding the grid to MyDataEntities.Addresses.  If I modify any Address (using a Dialog), the grid properly reflects this change.  However, if I do the exact same code, but do MyDataEntities.Addresses.AddObject(myNewAddress), nothing I do can get the grid to reflect the change.  Restarting the app does, however.

Please; I'm pulling my hair out with this.

Kyle
0
Julian Benkov
Telerik team
answered on 23 Sep 2011, 02:40 PM
Hi Kyle,

Thank you for writing.

To properly update the grid in this scenario your data source object must implement IBindingList interface. In the EF4 context if you bind RadGridView control to a query, the result of the query is IEnumerable<> and in this situation you not receive notification for any CRUD operations in the DataSource object. Please refer the MSDN documentation for binding objects to Windows Forms Controls to resolve this problem.

I hope this helps.

Regards,
Julian Benkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kyle
Top achievements
Rank 1
answered on 26 Sep 2011, 02:09 PM
I never was able to get the RadGridView to properly bind to an EF collection and observe changes.  However, I can now refresh the grid by setting the .DataSource again, utilizing the method mentioned in the MSDN post.  .Execute appears to work.

Thank you for your input.
0
Julian Benkov
Telerik team
answered on 29 Sep 2011, 08:57 AM
Hello Kyle,

I am glad to hear that you have solved your issue.

Do not hesitate to contact us if you have further questions or issues.

All the best,
Julian Benkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Alwin
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Kyle
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or