Articles in this section
Category / Section

How to get the row data from GridDataBoundGrid?

2 mins read

In order to retrive each records in GridDataBoundGrid, GetRecordStateAtRowIndex method can be used and the each value for record can be retrieved by using GetValue method of GridBoundColumn in WinForms Grid.

C#

for (int row = 1; row <= this.gridDataBoundGrid1.Binder.RecordCount; row++)
{
    //Getting the row state information
    GridBoundRecordState record = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(row);
    string message = string.Empty;
    foreach (GridBoundColumn column in this.gridDataBoundGrid1.Binder.InternalColumns)
    {
              //Here you can get the row data for each columns based on record
             PropertyDescriptor columndata= column.PropertyDescriptor;
             string value = columndata.GetValue(record.Table[record.Position]).ToString();
        
    }
}

 

VB

For row As Integer = 1 To Me.gridDataBoundGrid1.Binder.RecordCount
    'Getting the row state information
    Dim record As GridBoundRecordState =    Me.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(row)
    For Each column As GridBoundColumn In Me.gridDataBoundGrid1.Binder.InternalColumns
            'Here you can get the row data for each columns based on record
            Dim columndata  As PropertyDescriptor = column.PropertyDescriptor
            Dim value As String = columndata.GetValue(record.Table(record.Position)).ToString()
    Next column
Next row

 

Screenshot

Sample links:

C#: RowData_CS

VB:RowData_VB 

Conclusion

I hope you enjoyed learning about how to get the row data from GridDataBoundGrid.

You can refer to our WinForms Grid feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied