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 some validation in the business layer of my application. If it fails for a row in the database I will get an exception in the UI layer along with the value of the key for the row in the data that had the problem.
So from the UI I have a GDBG and a string which is the key to the offending row. The key is NOT stored in the grid. I think I need to do the following:
1. Use the key to identify the row in the underlying datalayer. 2. Then find the row in the GDBG for the row in the datalayer. 3. Move focus to that row (I don’t need help with that part)
I am having trouble making this work. Could you please provide an example.
JJJisha Joy Syncfusion Team June 11, 2009 09:25 AM UTC
Hi Mark,
If you are having record index of the underlying datasource, you could try using the ListManagerPositionToRowIndex method.This is used to find the row index within the grid from the row index within the data source.
I have tried ListManagerPositionToRowIndex. It worked untill I sorted the grid. After a sort it would still return the same value (where the row in the grid would have been if the grid was not sorted). Am I missing a step?
I can always put the key in the grid and hide it but I think there must be a better way.
RCRajadurai C Syncfusion Team June 13, 2009 11:27 AM UTC
Hi Mark,
Thanks for your update.
Please try the following code. CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember]; int pos = this.gridDataBoundGrid1.Binder.PositionToRowIndex(0); DataRow dr = ((DataRowView)cm.List[pos]).Row; Console.WriteLine(dr[0].ToString());
This code retrieves the data value of the first column from the underlying row position. There is no other direct way found to get the position of underlying row after sorting in griddataboundgrid.It has to be handled through some code manually.