The row data of sfdatagrid is not displayed.

I am using sfdatagrid.

It is processed normally, but sometimes rowdata is not displayed.
I want to share my code, but I can't because the code is long.

How can I check if the rowdata is displayed properly?

If it is not displayed properly, try to solve it by displaying it again.
Is it possible to solve it with refresh()?

7 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team June 9, 2021 08:33 AM UTC

Hi nam ki hun, 

Thank you for contacting Syncfusion Support. 

Based on provided information we have checked the reported issue “The row data of sfdatagrid is not displayed.” and unable to replicate the issue from our end. It is working fine as expected. Please find the tested sample and video demo from our end in the link below, 

        1. Provide the replication procedure with video illustration of the reported issue

 
if you are still facing the same issue? If yes, please modify the sample based on your scenario. 

It will be helpful for us to check on it and provide you the solution at the earliest. 

Regards, 
Vijayarasan S 



NK nam ki hun June 15, 2021 01:24 AM UTC

normal.



abnormal.



This happens intermittently in the same code.

I want to control it with events.
But I don't know the sequence of events in sfdatagrid.
Is there any way to solve this problem?
Or can you tell me the sequence of events in sfdatagrid?


VS Vijayarasan Sivanandham Syncfusion Team June 15, 2021 01:17 PM UTC

Hi nam ki hun,

Thanks for the update.

We are little unclear with your scenario. Can you please provide the more information related to your queries? 

Can you please share us below things?   
                
        1. Can you please confirm the reported problem occurs while SfDataGrid loading case or Scrolling the SfDataGrid 
        2. Provide code snippet related to SfDataGrid settings 
        3. Can you please confirm in your SfDataGrid column generated manually or autogenerated?
        4. Provided the details or code snippet related to type of DataSource and DataSource binding in SfDataGrid
        5. Provide replication procedure with video illustration of the reported problem 
        6. If possible, kindly provide a simple issue reproducible 
It will be helpful for us to check on it and provide you the solution at the earliest. 
Regards, 
Vijayarasan S 



NK nam ki hun June 22, 2021 09:48 AM UTC

Hi

I'm still analyzing to fix this issue.

Here is my code snippet:


private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)

        {

            using (DataSet ds = (DataSet)e.Argument)

            {

                sfDataGrid.DataSource = ds.Tables[0];

                ds.Tables[0].Dispose();

                ds.Dispose();

            }

        }

private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)

        {

            if (e.Error != null)

            {

                MessageBox.Show(e.Error.Message, "Error");

                return;

            }

        }


As you can see I am using backgroundWorker.

I checked e.Error.




Sometimes it works normally, and sometimes an error occurs like this.

But the code is the same.


My feeling is that this problem occurred when I used a large DataSet.

Using a small DataSet reduces this problem.

I need your help.


Regards,

Ki Hun.



VS Vijayarasan Sivanandham Syncfusion Team June 23, 2021 02:01 PM UTC

Hi Nam ki hun,

Thanks for the update.

Based on provided information the data received in your is coming from another thread context than the UI thread, and that's the reason you see this error.

You can resolve the reported error by set the SfDataGrid.DataSource RunWorkerCompleted event in BackgroundWorker. Please refer the below code snippet, 
backgroundWorker1.DoWork += backgroundWorker1_DoWork; 
backgroundWorker1.RunWorkerCompleted += BackgroundWorker1_RunWorkerCompleted; 
 
private void BackgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) 
{ 
            //set the result value to SfDataGrid.DataSource 
            sfDataGrid1.DataSource = e.Result; 
            if (e.Error != null) 
            { 
                MessageBox.Show(e.Error.Message, "Error"); 
                return; 
            } 
} 
 
private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) 
{             
            using (DataSet ds = (DataSet)e.Argument) 
            { 
                //set the datasoure to result 
                e.Result = ds.Tables[0]; 
                ds.Tables[0].Dispose(); 
                ds.Dispose(); 
            } 
} 
if you are still facing the same issue? If yes, please modify the sample based on your scenario. 
Can you please share us below things?         
        1. Provide the replication procedure with video illustration of the reported issue 
It will be helpful for us to check on it and provide you the solution at the earliest.

Regards,
Vijayarasan S
 


Marked as answer

NK nam ki hun June 25, 2021 08:14 AM UTC

Thank you.


I solved the problem in two ways.


1. Don't use BackgroundWorker.

2. Using your code snippet.


Both methods were successful.

Thank you very much for your help.


Regards,

Ki Hun



VS Vijayarasan Sivanandham Syncfusion Team June 25, 2021 10:03 AM UTC

Hi Nam ki hun,

Thanks for the update.

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.

Regards,
Vijayarasan S


Loader.
Up arrow icon