The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have a bound grid and while iterating on the collection of selected rows I want to access the underlying datatable.
Alas, if the user has altered the row order by sorting on a column, the index of a row in the grid is not the index of the same row in the datatable.
How can I get a row in the bound datatable having the index of a row in the grid?
Thank you.
ADAdministrator Syncfusion Team March 17, 2004 10:50 AM UTC
You can get the row object (either DataRowView or DataRow) through the currencymanager. This will allow you to access any fields (columns) in the datarow.
//for a given rowIndex
int position = this.Binder.RowIndexToPosition(rowIndex);
CurrencyManager cm = (CurrencyManager) this.BindingContext[this.grid.DataSource, this.grid.DisplayMember];
DataView dv = (DataView) cm.List;
DataRowView drv = dv[position];
//now you can access the fields with code like
object colNameValue = drv["colName"];
RRRaul RosenthalMarch 17, 2004 11:16 AM UTC
I copied and pasted your sample, and it works as expected, though I don''t understand exactly why.
Once more, thank you!