Grid detail error upon on initialized

It gives me this error upon on initializeGridDetail1error.png


5 Replies

RS Renjith Singh Rajendran Syncfusion Team August 2, 2022 06:05 AM UTC

Hi Belle,


Greetings from Syncfusion support.


We are not clear about exact issue or the scenario you are facing the issue. We need the following details to further proceed on this scenario. Kindly get back to us with the following details for better assistance.


  1. Share a simple issue reproducing sample based on your scenario for us to validate.
  2. Share with us a exact scenario you are facing the reported problem.
  3. Share the complete Grid rendering codes and model class codes.


The provided information will help us analyze the problem, and provide you a solution as early as possible.


Regards,

Renjith R





BP Belle Perez August 3, 2022 09:14 AM UTC

This is the codebase


Attachment: CPEditBase_e559e46e.rar


BP Belle Perez August 3, 2022 09:14 AM UTC

This is the razor


Attachment: CPEdit_ba5d5ea.rar


MS Monisha Saravanan Syncfusion Team August 5, 2022 01:54 PM UTC

Hi Belle,


Thanks for the update.


We have checked your shared codes and we could see that you have rendered multiple grids inside tabs. We suspect that the reported issue occurs when we perform operation in GridDetail2 will make a call to the ComputeDetail method at that time the instance of grid 1 (GridDetail1) will be null. So the null reference exception is thrown when trying to get current view records.


Kindly check whether the GridDetail1 instance is non null before accessing. Kindly check the attached code snippet for your reference.


public async Task ComputeDetail()

    {

        AllowSelection = false;

 

        //TotalBalance = CPHeaderEdit.CheckAmount - TotalAmountPaid;// August 1, 2022

        //await GridDetail1.UpdateCell(RowIndexDetail, "Balance", TotalBalance);// August 1, 2022

 

        AllowSelection1 = true;

 

        TotalAmountPaid = 0;

 

        TotalBalance = 0;

 

        CheckBalance = 0;

         if (GridDetail1 != null)

        {

          

        //Sales Invoice

        UnChanged.Clear();

         var ChangedData1 = await GridDetail1.GetBatchChangesAsync();    //get batch changes

            var CurrentView1 = await GridDetail1.GetCurrentViewRecordsAsync();    // get current view data

 

 


If the reported issue still persist or if we misunderstood your query then kindly share the below details to validate further at our end.


  1. Share us when you are facing the issue while using valuechange/cellsave/batchdelete.
  2. Share us some more details regarding your exact query.
  3. Share us the video demonstration of the issue along with replication procedure
  4. If possible share us an simple issue reproduceable sample.


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.



Regards,

Monisha



MS Monisha Saravanan Syncfusion Team August 8, 2022 03:56 AM UTC

Hi Belle,


Thanks for the update.


We have checked your shared codes and we could see that you have rendered multiple grids inside tabs. We suspect that the reported issue occurs when we perform operation in GridDetail2 will make a call to the ComputeDetail method at that time the instance of grid 1 (GridDetail1) will be null. So the null reference exception is thrown when trying to get current view records.


Kindly check whether the GridDetail1 instance is non null before accessing. Kindly check the attached code snippet for your reference.


public async Task ComputeDetail()

    {

        AllowSelection = false;

//TotalBalance = CPHeaderEdit.CheckAmount - TotalAmountPaid;// August 1, 2022

//await GridDetail1.UpdateCell(RowIndexDetail, "Balance", TotalBalance);// August 1, 2022

        AllowSelection1 = true;

        TotalAmountPaid = 0;

        TotalBalance = 0;

        CheckBalance = 0;

if (GridDetail1 != null)

        {

        //Sales Invoice

        UnChanged.Clear();

var ChangedData1 = await GridDetail1.GetBatchChangesAsync();    //get batch changes

            var CurrentView1 = await GridDetail1.GetCurrentViewRecordsAsync();    // get current view data


If the reported issue still persist or if we misunderstood your query then kindly share the below details to validate further at our end.


  1. Share us when you are facing the issue while using valuechange/cellsave/batchdelete.
  2. Share us some more details regarding your exact query.
  3. Share us the video demonstration of the issue along with replication procedure
  4. If possible share us an simple issue reproduceable sample.


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.



Regards,

Monisha


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Loader.
Up arrow icon