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.

Selected rows get shifted up

Thread ID:

Created:

Updated:

Platform:

Replies:

33555 Aug 22,2005 07:32 PM Aug 22,2005 08:41 PM Windows Forms 1
loading
Tags: GridControl
Bidin Dinesababu
Asked On August 22, 2005 07:32 PM

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

Administrator [Syncfusion]
Replied On August 22, 2005 08:41 PM

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

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.

;