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

Can not forward tab key through an empty DataboundGrid.

Hi, I am using DataboundGrid in 1.6.1.8 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

3 Replies

AD Administrator Syncfusion Team 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;


AD Administrator Syncfusion Team 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


AD Administrator Syncfusion Team 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);
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon