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

Error while using this.sfDataGrid.View.Records.Count

When I open my form and my grid is empty without record it presents error in the "this.sfDataGrid.View.Records.Count" method "System.NullReferenceException: 'Object reference not set to an instance of an object.'"
The error only occurs when there is no record in sfdatagrid. Now when you have a record the error does not occur.
I looked for some solution but I did not find it, if you have another way I would know.

1 Reply

JP Jagadeesan Pichaimuthu Syncfusion Team April 3, 2019 01:27 PM UTC

Hi Alan, 
Thanks for using Syncfusion product. 
We have checked the reported problem in our end and we suspect the issue may occurs due to datasource property is not initialized to SfDataGrid. The SfDataGrid.View will be created only when set the DataSource property of the control. But if datasource is set with zero records, it will not causing any issues. Please refer the sample which we try to reproduce the issue in our end. 
If we misunderstood your requirement, please provide more information like reproducible sample or any other customizations in SfDataGrid. This would help us to proceed further. 

Live Chat Icon For mobile
Up arrow icon