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.

Grid in Cell

Thread ID:





3862 Apr 14,2003 11:55 PM Apr 15,2003 11:55 AM Windows Forms 3
Tags: GridControl
Asked On April 14, 2003 11:55 PM

Hi, I created a cell in a DataBoundGrid with another grid in it (based on GridGridInCell sample). Now 2 questions: 1. If the user clicks on the cell with the grid in it how can I set the current cell in the embedded grid according to the mouse position? 2. How can I react correctly on the arrow and tab keys? I mean: If current cell of the embedded grid is the first column and I press left arrow or shift+tab the current cell moves the current cell to the cell left of the embedded grid and so on?

Administrator [Syncfusion]
Replied On April 15, 2003 04:37 AM

1) One way you can do this is to listen for the parent grid's cellclick event in the embeddedgrid, and then move currentcell in your handler.
//in the embedded grid's constructor
parent.CellClick += new GridCellClickEventHandler(ClickedOnParentCell);

//the handler
private void ClickedOnParentCell(object sender, GridCellClickEventArgs e)
	Point pt = this.PointToClient(Control.MousePosition);
		int row, col;
		if(this.PointToRowCol(pt, out row, out col, 1))
			this.CurrentCell.MoveTo(row, col, GridSetCurrentCellOptions.SetFocus);

2) In the embedded grid'c constructor, set its WrapCellBehavior property, and hook the WrapNextControlInForm event and handle the moving the the event handler.
//in the constructor
this.Model.Options.WrapCellBehavior = GridWrapCellBehavior.NextControlInForm;

this.WrapCellNextControlInForm += new GridWrapCellNextControlInFormEventHandler(TabToNextParentCell);

private void TabToNextParentCell(object sender, GridWrapCellNextControlInFormEventArgs e)
	GridControl grid = (GridControl) this.Parent;
	e.Cancel = true;

Replied On April 15, 2003 07:33 AM

Thanx Clay it works. Now another question: How can I do the same (select next parent cell) for up and down arrow? Regards Peter

Administrator [Syncfusion]
Replied On April 15, 2003 11:55 AM

This is not handled by properties. So, I think you will have to derive your grid, override OnKeyDown and do the work there for the up and down arrows.


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.