When does the UpdateUnboundColumn() method is invoked

Hi,

I have sfDataGrid where I have added an unbound column called "Volume"

//add unbound columns
            pipeDataSfDataGrid.Columns.Add(new GridUnBoundColumn()
            {
                HeaderText="Volume (m3)",
                MappingName="Volume",
                Width=75
              });

I am using the QueryUnboundColumnValue event to populate the column values like this

private void pipeDataSfDataGrid_QueryUnboundColumnValue(object sender, GridUnboundColumnEventsArgs e)
        {
            if (e.UnBoundAction==UnBoundActions.QueryData)
            {
                switch (e.Column.MappingName)
                {
                    case "Volume":
                        var size = Convert.ToInt32(e.Record.GetType().GetProperty("PipeDataSizeID").GetValue(e.Record));
                        var length = Convert.ToDouble(e.Record.GetType().GetProperty("PipeDataLength").GetValue(e.Record));
                        e.Value = CalculateVolume(size, length);
                        break;
                }
            }
          
        }
Also in CurrentCellEndEdit event I am forcing to invoke the QueryUnboundColumnValue() event by using UpdateUnboundColumn like this

private void pipeDataSfDataGrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs e)
        {
           
            var recordindex = pipeDataSfDataGrid.ResolveToRecordIndex(e.RowColumnIndex.RowIndex);
            var record = pipeDataSfDataGrid.View.Records.GetItemAt(recordindex);
            pipeDataSfDataGrid.UpdateUnboundColumn(record, "Volume");
           
        }
everytime the UpdateUnboundColumn is fired it does not invoke the QueryUnboundColumnValue() event.

I need to know if I have not set up something that prevents me from population my unbound column.
I have attached source code

Attachment: Piping_26cce7a7.zip

6 Replies

VS Vijayarasan Sivanandham Syncfusion Team May 14, 2020 03:36 AM UTC

Hi Mariusz Juszkiewicz,

Thank you for contacting Syncfusion support.

Currently, we are analyzing your requirement of “When does the UpdateUnboundColumn() method is invoked”. We will validate and update you the details on May 15, 2020.
 
 
We appreciate your patience until then. 
 
Regards, 
Vijayarasan S 



VS Vijayarasan Sivanandham Syncfusion Team May 15, 2020 03:54 PM UTC

Hi Mariusz Juszkiewicz,

Thank you for your patience,

Your requirement can be achieved by calling BeginInit and EndInit method in CurrentCellEndEdit event. Please refer the below code snippet,
 
private void pipeDataSfDataGrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs e) 
{ 
            this.pipeDataSfDataGrid.View.BeginInit(); 
            var recordindex = pipeDataSfDataGrid.ResolveToRecordIndex(e.RowColumnIndex.RowIndex); 
            var record = pipeDataSfDataGrid.View.Records.GetItemAt(recordindex); 
            pipeDataSfDataGrid.UpdateUnboundColumn(record, "Volume"); 
            this.pipeDataSfDataGrid.View.EndInit(); 
 
} 
 
We hope this helps. Please let us know, if you require further assistance on this. 
Regards,
Vijayarasan S 



MJ Mariusz Juszkiewicz May 18, 2020 11:49 PM UTC

Thank you for your support.
This came to a new problem I am having. I have added another unbound column to my sfdatagrid and I am also using UpdateUnboundColumn() method to explicitly calculate value. This time however I receive an error System.NullReferenceException: 'Object reference not set to an instance of an object.' when I try to enter the size for example after the new line has been added to the sfdatagrid.

Attachment: Piping_a898e2a1.zip


VS Vijayarasan Sivanandham Syncfusion Team May 19, 2020 01:51 PM UTC

Hi Mariusz Juszkiewicz,

Thanks for the Update.

We have checked the reported issue in simple sample and unable to replicate the issue from our end. Please find the tested sample and video demo from our end in the below link,

Sample Link: https://www.syncfusion.com/downloads/support/forum/154176/ze/Sample1624444612
 

Can you please share us below things?
       
        1. Brief replication procedure/video illustration of the reported issue
 
       
if you still facing the same issue? If yes, please modify the sample based on your scenario. 

Regards,
Vijayarasan S
 



MJ Mariusz Juszkiewicz May 20, 2020 03:04 AM UTC

Hi,

I have attached video with my error on my application. I am trying to replicate the same on your sample.

Attachment: 20200519205903_fe1e8d1b.zip


VS Vijayarasan Sivanandham Syncfusion Team May 21, 2020 03:55 AM UTC

Hi Mariusz Juszkiewicz,

Thanks for the update.

 
We have created a new incident under your Direct trac account. We suggest you to follow up with the incident for further updates. Please log in using the below link. 

https://www.syncfusion.com/support/directtrac/incidents/278104 

Regards,
 
Vijayarasan S 


Loader.
Up arrow icon