We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Updating the underlying datasource (exceptions thrown when using a dataview)

I have a datatable with a collection of data (id, formula, price). The price field in this datatable is constantly updated with new values.

I then create a dataview on this datatable, filtering on whichever ID (one of the fields in the datatable) is appropriate.

I then bind this dataview to a grid grouping control. This all works correctly.

however, when i try to update the price field in the datatable (for any row i.e. rows that may be in the dataview or not in the dataview) I get the following exception thrown:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in Syncfusion.Grouping.Base.dll

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at Syncfusion.Grouping.UnsortedRecordsCollection.get_Item(Int32 index)
at Syncfusion.Grouping.Table.dt_ColumnChanging(Object sender, DataColumnChangeEventArgs e)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanging(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRow.set_Item(String columnName, Object value)
at EQTG.Viper.Models.SpotPricesModel.ProcessPendingUpdates() in C:\PseudoE\Perforce\Viper_Branch\client\EQTG.Viper.Models\SpotPricesModel.cs:line 278


FYI, if i do not use a dataview, as display the full datatable, i do not get this exception. But it is essential that i have the view on the total set of data. Please help.

Thanks,

Mike

6 Replies

AD Administrator Syncfusion Team March 14, 2007 05:37 PM UTC

Hi Mike,

We are really sorry for the delay in responding. We have tested the mentioned issue. We could not reproduce the issue here. Could you please provide us a sample having the issue? This will help us to resolve the issue soon.

Thanks for choosing Syncfusion products.

Regards,
Haneef


OP Oliver Politzki July 21, 2017 08:12 AM UTC

Hi there.

We have the same problem, but it only occurs, if the binded property has a OnPropertyChanged - implementation in its setter:

public class SomeClass : SomeBaseClass

    {

        private string _name;

      public string Name

        {

            get { return _name; }

            set

            {

                _name = value;

                OnPropertyChanged();

            }

        }

}

And in the base class:

public class SomeBaseClass

{

[NotifyPropertyChangedInvocator]

protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)

        {

            var handler = PropertyChanged;

            if (handler == null) return;

            var prop = new PropertyChangedEventArgs(propertyName);            

            handler(this, prop); <-- here happens the exception

        }

}



AR Arulpriya Ramalingam Syncfusion Team July 24, 2017 12:57 PM UTC

Hi Customer, 

Thanks for using Syncfusion products. 

We have tried all the possibilities to reproduce the issue at our end, but unfortunately we could not. We analyzed your code part, it seems that INotifyPropertyChanged interface is not implemented in your code. We have created a simple sample as per your code and please refer to the attached sample, 
Please provide the below details which will help us to provide a proper solution at the earliest. 

  • Ensure the reported issue occurred in attached sample.
  • Modify the attached sample with issue replication.
  • StackTrace details of exception.

Code part 
 
public class SomeBaseClass : INotifyPropertyChanged 
{ 
[NotifyPropertyChangedInvocator] 
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) 
/// 
/// 
 

Regards, 
Arulpriya 



OP Oliver Politzki July 24, 2017 01:22 PM UTC

Hello Arulpriya,sorry, I forgot to mention that we use a class called Annotation.cs from JetBrains ReSharper, in which these attributes like NotifyPropertyChangedInvocator are declared. I've updated your source files and could reproduce the exception. You have to turn on exception catching, otherwise it seems like nothing happens after inserting a new row in the datagrid.Take a look at the attachment. Thanks and best regards,OliverAttachment: Exception734425682_738fec2d.zip


OP Oliver Politzki July 24, 2017 01:23 PM UTC

Somehow my attachement got destoryed by editing it


Attachment: Exception734425682_9785786f.zip


AR Arulpriya Ramalingam Syncfusion Team July 25, 2017 05:03 PM UTC

Hi Oliver, 

Thanks for your update. 

We could understand your scenario. The INotifyPropertyChanged interface can be implemented to indicate whenever the changes occurs in property values. We have created a simple sample as per your requirement. Please make use of below code and attached sample, 

Code snippet 
 
public class SomeBaseClass :  INotifyPropertyChanged 
{ 
               private ArrayList list; 
       /// 
       /// Some Code 
       /// 
} 
 
 
 
Regards, 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon