RadzenDataGrid View property

Hello, I had a quick question. Does anyone have an example of how to iterate through the datagrid "View" property to get the data? I know how to loop through the ColumnsCollection to get the column title, property, etc, but not sure how to loop through that view.

Thanks for your help.

The View property is normal IEnumerable. You can loop it like this:

foreach(var item in grid.View)
{
//
}

1 Like

Thank you. That part I understood, but I'm still missing something. We have a class that exports the data to excel and I pass the RadzenDataGrid dataGrid into it. The code is then below, but I can't get the actual values from the data. Columns work without any issues.

        var wb = new XLWorkbook();
        var ws = wb.Worksheets.Add("Data");

        // Get column headers            
        for (int row = 0; row < dataGrid.ColumnsCollection.Count; row++)
        {
            ws.Cell(1, row + 1).Value = dataGrid.ColumnsCollection[row].Title;
        }
        
        // Get data
        foreach(var item in dataGrid.View)
        {
            Console.WriteLine(item);
        }