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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I get the underlying datasource record when user enter a cell in the grid control

Thread ID:





49455 Sep 19,2006 02:25 PM UTC Sep 20,2006 06:06 AM UTC WinForms 1
Tags: GridControl
Asked On September 19, 2006 02:25 PM UTC

How do I get the underlying datasource record when user enter a cell in the grid control?

I trying to do that in the CellActivating event, which I am not sure is the right place to do this?

Administrator [Syncfusion]
Replied On September 20, 2006 06:06 AM UTC

Hi James,

Issue 1:

Are you using the GridDataBoundGrid? If so, you can handle the CurrentCellActivated / CurrentCellMoved(For every cellmovement) event to get the record using the below code.

CurrencyManager cm = this.BindingContext[this.grid.DataSource] as CurrencyManager;
DataView dv = cm.List as DataView;
DataRowView currentRecord = cm.Current as DataRowView ;
Console.WriteLine(currentRecord[0]) ;

Refer the below forum thread for getting the selected rows in a grid. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=47865

Issue 2:

Are you using the GridControl? If so, you can handle the CurrentCellMoved event to get the cell values in a row using the below code.

//Bcoz Gridcontrol is a cell-based control..
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
for(int i = 1; i < grid.ColCount;i++)
Console.Write(" => " + grid.Model[cc.RowIndex,i].Text);

Let me know if this helps.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon