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.
Unfortunately, activation email could not send to your email. Please try again.

Add row on key press

Thread ID:

Created:

Updated:

Platform:

Replies:

21214 Nov 4,2004 09:04 AM Nov 4,2004 10:06 AM Windows Forms 1
loading
Tags: GridControl
Kewalramani Kanchan
Asked On November 4, 2004 09:04 AM

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.

Administrator [Syncfusion]
Replied On November 4, 2004 10:06 AM

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);
	}
}

CONFIRMATION

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.

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.

;