Selecting a row programmatically

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();

2 Replies

AD Administrator Syncfusion Team June 30, 2003 10:02 PM UTC

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;
	}
}


DD Diego Diaz July 1, 2003 12:37 PM UTC

Worked nicely! Thanks Clay.

Loader.
Up arrow icon