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
close icon

Add row on key press

We are trying to provide a feature to add a new row by hitting the Tab or F9 key by trapping the Key down event. This event doesn’t get trigged when the user is editing a value on a particular column. Is there a way we can implement this ? Note: We are trying to avoid using the Key press event of the column as they would be triggered for all the every key which might affect the performance of the application. Also, there is a constraint in the application that data in all the previous row should be entered before adding the new row.

1 Reply

AD Administrator Syncfusion Team November 4, 2004 03:06 PM UTC

You can derive the grid and override ProcessCmdKey to catch these keys and add a row.
public class MyGridDataBoundGrid : GridDataBoundGrid
{
	protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
	{
		if((0 != (keyData & Keys.Tab)) || (0 != (keyData & Keys.F9)))
		{
			  this.Binder.AddNew();
			 return true; //ignore the key
		}
		return base.ProcessCmdKey (ref msg, keyData);
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon