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.

Selecting a row programmatically

Thread ID:

Created:

Updated:

Platform:

Replies:

5355 Jun 30,2003 03:17 PM Jul 1,2003 08:37 AM Windows Forms 2
loading
Tags: GridControl
Diego Diaz
Asked On June 30, 2003 03:17 PM

Hello, I'm trying to do something that in theory should be very simple, but I'm getting some trouble making it to work. I just need to select a row programmatically whenever the user changes the current cell, so the row containing it will be selected. I'm executing the code listed below, but it doesn't seem to work. I am using 1.6.1.0. Thanks in advance for your help, Diego Diaz gridControlResults.Model.SuspendChangeEvents(); gridControlResults.Selections.Ranges.Clear(); gridControlResults.Selections.Ranges.Add(GridRangeInfo.Row(m_lastrangeInfo.Bottom)); gridControlResults.Model.ResumeChangeEvents();

Administrator [Syncfusion]
Replied On June 30, 2003 06:02 PM

Here is one try at this.
private bool okToClear = false;
private void gridDataBoundGrid1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	okToClear = false;
	this.gridDataBoundGrid1.Selections.Clear();
	okToClear = false;
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	this.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Row(cc.RowIndex));
}

private void grid_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
	if(e.Range.IsEmpty)
	{
		e.Cancel = !okToClear;
	}
}

Diego Diaz
Replied On July 1, 2003 08:37 AM

Worked nicely! Thanks Clay.

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.

;