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.
Unfortunately, activation email could not send to your email. Please try again.

virtual grid - capturing selected row changed

Thread ID:

Created:

Updated:

Platform:

Replies:

52486 Nov 29,2006 07:43 AM Nov 30,2006 12:00 AM Windows Forms 1
loading
Tags: GridControl
Adam K.
Asked On November 29, 2006 07:43 AM

i want to be able to capture an event from the grid when the user changes selected rows.

which event from the grid should i listen to capture this here ?

I tried using the selection changed event but the first time the user clicks on the grid the value or rowIndex is -1 which doesn't help much.

Again, my requirement is to simply have an event raised when a user changes rows. In the callback of that event, i would like to know the current row selected. Any ideas? Can you send me an example.

thks,
ak

Administrator [Syncfusion]
Replied On November 30, 2006 12:00 AM

Hi Adam,

You can handle the CurrentCellMoved event and use Selections.Ranges.AnyRangeContains() method to determine the current row selection in a grid. Here is a code snippet

private void gridControl1_CurrentCellMoved(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellMovedEventArgs e)
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;

if( grid.Model.Selections.Ranges.AnyRangeContains(GridRangeInfo.Row(cc.RowIndex)))
{
Console.WriteLine("CurrentRowNo: {0} Selected", cc.RowIndex );
}
}

Best Regards,
Haneef

CONFIRMATION

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.

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.

;