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

Can not forward tab key through an empty DataboundGrid.

Thread ID:





14737 Jun 3,2004 12:31 PM UTC Jun 8,2004 02:56 PM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On June 3, 2004 12:31 PM UTC

Hi, I am using DataboundGrid in VS.NET 2003/XP. While tabbing through all the fields in a form, if I enter a data bound grid that is empty, it is getting stuck. 1. Run the attached sample. 2. Hit tab key 4 times. This will put you in the grid. Now you are stuck in the grid and can not get out using keyboard. 3. If you click ''Add some data'' button and then tab twice, I don''t see the focus. But again hitting tab puts you in grid cell R1C1. 4. Click ''Clear data'' and hit tab. Notice that the focus is gone and you can not get out of grid using keyboard. Any ideas on how to avoid this? thanks, - Reddy GridTabTest_5300.zip

Administrator [Syncfusion]
Replied On June 3, 2004 12:42 PM UTC

Initially, try setting: this.gridDataBoundGrid1.WantTabKey = false; Then when the datasource is populated with some rows, set it to: this.gridDataBoundGrid1.WantTabKey = true;

Administrator [Syncfusion]
Replied On June 8, 2004 01:46 PM UTC

It will be hard to know when the datasource is being set. Sometimes the user may delete all the rows in the grid. Sometimes the grid gets emptied out in a master-detail scenario. I added ''Enter'' event handler to see if the grid has any data. If not, I am setting WantTabKey to false. So, toggling WantTabKey is kind of hard todo throughout the application. Is there any other way? thanks, - Reddy

Administrator [Syncfusion]
Replied On June 8, 2004 02:56 PM UTC

You can try dynamcially setting it in an override of ProcessCmdKey when a tab comes in.
public class MyGridDataBoundGrid : GridDataBoundGrid
	protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
		if(keyData == Keys.Tab)
			BindingManagerBase bmb = this.BindingContext[this.DataSource, this.DataMember];
			this.WantTabKey = bmb.Count != 0;
		return base.ProcessCmdKey (ref msg, keyData);


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