How to refresh bound grid to show new record?

6 posts, 1 answers
  1. Jingying
    Jingying avatar
    19 posts
    Member since:
    May 2009

    Posted 02 Jun 2009 Link to this post

    i have my Datagrid bound to a global collection.
    When i add new record to the global collection, how do i get the datagrid to refresh so that the new record shows up in the data grid?
  2. Answer
    Vlad avatar
    15 posts
    Member since:
    Oct 2004

    Posted 02 Jun 2009 Link to this post

    If your collection is INotifyCollectionChanged the grid will show new record automatically - in all other situations you can call Rebind() method.
  3. DevCraft R3 2016 release webinar banner
  4. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 05 May 2010 Link to this post

    Also be careful when you have filters applied to your collection as this could result in a refresh not working if you just issue a Rebind.  Make sure you re apply any filter you added and if this means you don't need the rebind then don't use the rebind but your own filter instead.

  5. Sajan
    Sajan avatar
    4 posts
    Member since:
    Sep 2012

    Posted 05 Sep 2012 Link to this post

    Hi Vlad,
    i have implemented notify property changed. it brings all the new records immediately but it does not show the updated value of record.
  6. Pavel Pavlov
    Pavel Pavlov avatar
    2039 posts

    Posted 06 Sep 2012 Link to this post


    The approach would be similar :

    In your Record objects , you should implement the INotifyPropertyChanged interface.

    Generally RadGridView would respect both: INotifyCollectionChanged and INotifyPropertyChanged interfaces.
    If you have them correctly implemented any updates would be reflected automatically at the UI with no need of you to take care of it.

    All the best,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. Sajan
    Sajan avatar
    4 posts
    Member since:
    Sep 2012

    Posted 06 Sep 2012 Link to this post

    Hi Pavel Pavlov,
    I have implemented it like this. Can you please check if i am missing something.
    public class SalesOrderViewModel : INotifyPropertyChanged
          //Supplies the collection of Products that the Mainpage.ProductList binds to
          public ObservableCollection<SalesOrder> Orders { get; set; }
          private SalesOrder _selectedOrder;
          public SalesOrder SelectedOrder
              get { return _selectedOrder; }
                  _selectedOrder = value;
          public event PropertyChangedEventHandler PropertyChanged;
          /// <summary>
          /// NotifyPropertyChanged will raise the PropertyChanged event passing the
          /// source property's name that is being updated.
          /// </summary>
          /// <param name="propertyName"></param>
          public void NotifyPropertyChanged(String propertyName)
              if (PropertyChanged != null)
                  PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
          public SalesOrderViewModel()
              Orders = new ObservableCollection<SalesOrder>();
              SelectedOrder = null;

    It will be a great help.
Back to Top
DevCraft R3 2016 release webinar banner