We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Currently selected row information

I''m trying to obtain data from the currently selected row. Based on the grid-control I tried: CurrencyManager cm= (CurrencyManager) this.BindingContex[this.gridGroupingControl2.DataSource]; DataRow term = ((DataRowView) cm.Current).Row; this.editControl1.Text = term["Definition"].ToString(); But I keep on getting the first row. What is the easiest way to access the current row data on a gridGroupingControl Regards, Marco

1 Reply

AD Administrator Syncfusion Team February 2, 2004 02:01 PM

You can get the current record with Record r = groupingGrid.Table.CurrentRecord the record object provides methods to get values, e.g. r.GetValue("CustomerID"). You can also get the underlying DataRow when you call r.GetData(). That will return the DataRowView element for the record. When you want to access the current record through the binding context, make sure both the grid and the form have the same dataview and binding context. You can manually assign a BindingContext to the grouping grid (e.g you could assign myForm.BindingContext). Make also sure you use the same view that the grid is using. GroupingGrid.Engine.GetSourceList() will return a IList (which is the underlying DataSet.DefaultView or DataTable.DefaultView) whereas groupingGrid.Engine.DataSource can be the DataSet or DataTable object that you assigned to it in InitializeComponent. And passing in that object to BindingContext probably created a different DataView object and that''s why your code didn''t work. Stefan >I''m trying to obtain data from the currently selected row. Based on the grid-control I tried: > >CurrencyManager cm= (CurrencyManager) this.BindingContex[this.gridGroupingControl2.DataSource]; >DataRow term = ((DataRowView) cm.Current).Row; >this.editControl1.Text = term["Definition"].ToString(); > >But I keep on getting the first row. >What is the easiest way to access the current row data on a gridGroupingControl > >Regards, > >Marco

Loader.
Live Chat Icon For mobile
Up arrow icon