RowsChanging - Event does not fire

2 posts, 0 answers
  1. Andreas Haeusler
    Andreas Haeusler avatar
    25 posts
    Member since:
    Nov 2009

    Posted 20 Sep 2015 Link to this post

    Hello,

     

    I'm experiencing some problems with a gridview bound to a bindingsource (using entity framework 5).

    The RowsChanging event does not fire on binding operations, neither on the initial binding nor on any subsequent reloading of data. The RowsChanged event does. To my understanding before every RowsChanged event, the RowsChanging event should fire at least once.

     

    I tried using the gridview.Rows.CollectionChanging event, but it does not exist - though it should according to the documentation.

     

    The event DOES fire if I modify the​ rows at runtime (like removing one row).

     

    simplified version of the code (tried variations of binding to the MasterTemplate, with or without BeginEdit etc):

     

    Kind regards,

    Andreas

     

    public RadForm1()
    {
        InitializeComponent();
        radGridView1.RowsChanging += RadGridView1OnRowsChanging;          
        bs = new BindingSource {DataSource = context.Sonderthema_Art.ToList()};
        radGridView1.DataSource = bs;
    }
     
     
    private void RadGridView1OnRowsChanging(object sender, GridViewCollectionChangingEventArgs gridViewCollectionChangingEventArgs)
    {
        throw new NotImplementedException();
    }

     

  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 22 Sep 2015 Link to this post

    Hello Andreas,

    Thank you for writing.

    When setting the RadGridView.DataSource property, only the RowsChanged event is supposed to be fired. As to the RowsChanging event, it is fired only when you manually add/delete rows from the grid, because you can cancel this operation. When you add/delete an item from the BindingList or set the DataSource, this fires only the RowsChanged event and you are not allowed to cancel this operation.

    Since Q2 2010 (version 2010.2.10.713) the Rows.CollectionChanging event has been removed. We will update the online documentation.

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top