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 am using a button cell in a databound grid to select a record using the event "PushButtonClick"
The code I am using works fine when the grid is loaded, however when sorting using one of the headers and clicking the button it retrieves the wrong record. Code is below
gdbgGrid.CurrentCell.MoveTo(e.RowIndex, e.ColIndex);
dt = (DataTable)gdbgGrid.DataSource;
DNoteID = (Guid)dt.Rows[e.RowIndex-1]["DNoteID"];
How can I get the correct index from the grid when it is sorted. Thanks
Aaron
ADAdministrator Syncfusion Team March 31, 2005 02:10 PM UTC
You need to use the CurrencyManager to access the data if it can possibly be sorted.
int pos = grid.Binder.RowIndexToPosition(e.RowIndex);
CurrencyManager cm = (CurrencyManager) grid.BindingContext[grid.DataSource, grid.DataMember];
DataRowView drv = (DataRowView)cm.List[pos];
//DataRow dr = drv.Row;
MessageBox.Show(string.Format("{0} {1}", drv["1"], drv["2"]));