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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridControl.MoveTo and Focus

Thread ID:





38549 Dec 14,2005 09:24 PM UTC Dec 15,2005 08:01 PM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On December 14, 2005 09:24 PM UTC

Here is the problem: 1. I give grid the focus 2. then call this.grid.CurrentCell.MoveTo( 1, 2, GridSetCurrentCellOptions.SetFocus ); which makes the grid loose focus 3. User presses tab while in cell [1,2]. 4. In OnSaveChanges, I hide the usercontrol in cell [1,2]. 5. .Net sets the focus to "next" control after the grid, since the grid lost focus in step2. 6. Your MoveTo moves the currentcell to [1,3], however the user cannot type anything in cell [1,3] because the focus neither the grid or the currentcell have focus due to step 5. This is the problem. Bug? Things work fine if in OnSaveChanges, I do if (this.CurrentCell.IsInMoveTo) this.Grid.Focus();

Administrator [Syncfusion]
Replied On December 14, 2005 11:04 PM UTC

Is the grid the parent of the UserControl in cell 2,1?

Administrator [Syncfusion]
Replied On December 15, 2005 07:46 PM UTC


Administrator [Syncfusion]
Replied On December 15, 2005 08:01 PM UTC

Since this is a custom cell, I think you will have to handle it in some manner. I do not think this is something we can control in a general way. Here are some other ideas to try if you do not like the solution you can up with: 1) See if implementing this interface makes a difference bool IQueryFocusInside.QueryFocusInside() { if (ContainsFocus) return true; else { foreach (Control c in this.Controls) { IQueryFocusInside qfi = c as IQueryFocusInside; if (qfi != null) { if (qfi.QueryFocusInside()) return true; } } } return false; } 2) Don’t hide the user control in OnSaveChanges. Instead hide the user control by overriding the Hide() method. 3) make sure you did call SetControl. If you called SetControl then the GridCellRendererBase.Hide method normally already takes care of properly hiding the control with proper focus management and ideas 1 and 2 should not be needed. 4) Set the following properties on the UserControl: .TabStop = false and .CausesValidation = false


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