Articles in this section
Category / Section

How do I locate the current row in my DataTable after the GridDataBoundGrid has been sorted or filtered?

1 min read


You can get the currently selected row in your DataTable through the CurrencyManager even if the table is filtered and/or sorted. If "Col0" is the name of a column in the datatable, you can get at the value of this column in the current row using the below code snippet.


CurrencyManager cm = (CurrencyManager) this.BindingContext[this.gridDataBoundGrid1.DataSource,


DataRow dr = ((DataRowView) cm.Current).Row;

this.label1.Text = dr["Col0"].ToString();


Dim cm As CurrencyManager = Me.BindingContext(Me.GridDataBoundGrid1.DataSource,


Dim dr As DataRow = CType(cm.Current, DataRowView).Row

Me.Label1.Text = dr("Col0").ToString()

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