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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid in Cell

Thread ID:





3862 Apr 15,2003 03:55 AM UTC Apr 15,2003 03:55 PM UTC WinForms 3
Tags: GridControl
Asked On April 15, 2003 03:55 AM UTC

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 08:37 AM UTC

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 11:33 AM UTC

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 03:55 PM UTC

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon