Selected rows get shifted up

Hi, I am facing a problem with DataBoundGrid. ( Using syncfusion 3.2 ). When I refresh the grid with data changes, I need to retain the row selections. Grid has filter bar wired to it. When grid gets refreshed, the filter bar gets re - wired ( to update the data changes to filter bar ). The behaviour I am getting is when the filter bar gets rewired ( FilterBar.WireGrid( this ) ) the row selection shifts one row up. Eg: if row 3 was selected before, it moves up to row 2. Checked the syncfusion code and this happens when grid filter bar is unwired. This operation shifts the selection one row up, which is correct as the filter row is getting removed. But when the filter gets re-wired this selection is not getting re calculated. Is there any easy way to get around this issue? THanks, Bidin

1 Reply

AD Administrator Syncfusion Team August 23, 2005 12:41 AM UTC

You can manually set the current cell and select the row after you call WireGrid.
private void button1_Click(object sender, EventArgs e)
{
	//add filter bar
	if(theFilterBar != null && !theFilterBar.Wired)
	{
		int row = this.gridDataBoundGrid1.CurrentCell.RowIndex;
		int col = this.gridDataBoundGrid1.CurrentCell.ColIndex;
		theFilterBar.WireGrid(this.gridDataBoundGrid1);
		this.gridDataBoundGrid1.CurrentCell.MoveTo(row + 1, col);
		this.gridDataBoundGrid1.Selections.Clear();
		this.gridDataBoundGrid1.Selections.SelectRange(GridRangeInfo.Row(row + 1), true);
		this.label2.Text = "";
	}
}
private void button2_Click(object sender, EventArgs e)
{
	//remove filter bar
	int pos = this.gridDataBoundGrid1.Binder.CurrentPosition;
	theFilterBar.UnwireGrid();
	this.gridDataBoundGrid1.Binder.CurrentPosition = pos;
}

Loader.
Up arrow icon