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

Row validating

Hello,I'm using visual studio 2015 and .Net 4.6,when I use :var data = e.RowData.GetType().GetProperty("BarCode").GetValue(e.RowData);I get the fallowing exception  Object reference not set to an instance of an objectRegards.

5 Replies

BR Balamurugan Rajaraman Syncfusion Team April 24, 2017 12:45 PM UTC

Hi Amine 
 
Thank you for contact Syncfusion support.  
 
We have analyzed your query “Exception while using the Row validating event”. We are not able to reproduce the reported issue in our Current Syncfusion produce version, it’s working fine in our side. We have attached the tested sample for your reference. Could you please revert us by modifying the sample to reported issue in our side and also share your Syncfusion Produce version. It will greatly helpful for us to analyze further.  
 
You can able to download the tested sample from the below link  
 
 
Regards,  
Balamurugan R  



AL Amine Laïeb April 24, 2017 03:15 PM UTC

Thank you for the replay but i think I got the error of  NullException .... Object reference not set to an instance of an object because I'm using Sql databese
Regards


BR Balamurugan Rajaraman Syncfusion Team April 25, 2017 12:03 PM UTC

Hi Amine   
  
As per your previous update, we have checked the reported problem by creating the sample with database, but we could not reproduce the reported issue in our Current product version. It is working fine from our side. We suspect that, this exception occurs if the property name provided in the RowValidating event is not to be available in the ItemSource bound to SfDataGrid. Could you please ensure this in your application? If the issue persists, then share your application or modified the sample to reproduce the reported issue to proceed further on this.   
  
Please refer the sample from the below link   
  

Regards,   
Balamurugan R   



AL Amine Laïeb April 30, 2017 08:20 AM UTC

I'm binding my Sfdatagrid directly to SqlServer without using any MVVM, so this code solve the problem for me :

            DataRowView dr = e.RowData as DataRowView;
            if (dr != null)
            {
                if (dr.Row["Category"] as string == null)
                {
                    e.IsValid = false;
                    e.ErrorMessages.Add("Category", "Can't be empty");
                }
             }  


SV Srinivasan Vasu Syncfusion Team May 1, 2017 04:50 AM UTC

Hi Amine, 
  
Thanks for your update. 
  
Please let us know if you need further assistance onthis. 
  
Regards, 
Srinivasan 


Loader.
Live Chat Icon For mobile
Up arrow icon