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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

143728 Apr 3,2019 12:06 AM UTC Apr 3,2019 01:27 PM UTC WinForms 1
loading
Tags: SfDataGrid
Alan Oliveira
Asked On April 3, 2019 12:06 AM UTC

Hello,
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.

Jagadeesan Pichaimuthu [Syncfusion]
Replied On 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. 
 
Regards, 
Jagadeesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon