can this be used as a shorter way to extract cell value?

Hello, 

I wanted to extract a cell value under a specific column for a selected row in sfDataGrid. One solution I found in a separate question but that is still confusing to me. However, I was simply tinkering with the code and found that there could be a shorter way to do that. For me, I just aim to get cell value for a selected row inside sfDataGrid, for which I used the following code:

            DataRowView record = (DataRowView)DG_CblLib.View.Records.GetItemAt(DG_CblLib.SelectedIndex);
            var cv = record.Row.ItemArray[DG_CblLib.TableControl.ResolveToGridVisibleColumnIndex(2)];

The code is working fine for me but just wanted to ask if there could be any situation where this code might fail to retrieve a cell value or may be any exception get raised for some unhandled error prone code that I forgot to pay attention to.

Thank you.

1 Reply 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team December 28, 2020 12:05 PM UTC

Hi Shankul Gupta,

Thank you for contacting Syncfusion support.

Based on provided information you can get the cell value properly using above mentioned forum by without making any error in sfDataGrid. In some other way to get the cell value in SfDataGrid mentioned in below UG link for your reference,

UG Link: https://help.syncfusion.com/windowsforms/datagrid/selection#get-the--cell-value
 
We hope this helps. Please let us know, if you require further assistance on this.

Regards,
 
Vijayarasan S


Marked as answer
Loader.
Up arrow icon