Refresh problem?

6 posts, 0 answers
  1. Alwin
    Alwin avatar
    12 posts
    Member since:
    May 2009

    Posted 29 Aug 2011 Link to this post

    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

  2. Alexander
    Admin
    Alexander avatar
    306 posts
    Member since:
    Sep 2012

    Posted 01 Sep 2011 Link to this post

    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 >>

  3. Kyle
    Kyle avatar
    9 posts
    Member since:
    Aug 2010

    Posted 20 Sep 2011 Link to this post

    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

  4. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts
    Member since:
    Sep 2012

    Posted 23 Sep 2011 Link to this post

    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 >>

  5. Kyle
    Kyle avatar
    9 posts
    Member since:
    Aug 2010

    Posted 26 Sep 2011 Link to this post

    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.

  6. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts
    Member since:
    Sep 2012

    Posted 29 Sep 2011 Link to this post

    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 >>

Back to Top