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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Edit Current Cell Value when KeyPress

Thread ID:





37436 Nov 22,2005 07:52 AM UTC Nov 22,2005 09:29 AM UTC WinForms 1
Tags: GridControl
Eric Pang
Asked On November 22, 2005 07:52 AM UTC

Hi, I am using GDBG, in some numeric fields, we want to have the feature of, when user types "t" or "m", we would times 1,000 and 1,000,000 respecitively on current cell value. (while user should not able to see the "t", "m" characters in the cell at all). Shall i handle it in CurrentCellKeyPress event? If so, how to get / update current cell value, while still keeping the current row as IsEditing? i.e. changes is not updated to underlying datasource yet. Thanks, Eric

Administrator [Syncfusion]
Replied On November 22, 2005 09:29 AM UTC

You can try handling this in CurrentCellValidateString.
private void gridDataBoundGrid1_CurrentCellValidateString(object sender, GridCurrentCellValidateStringEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(this.gridDataBoundGrid1.Binder.NameToColIndex("Col2") == cc.ColIndex
		&& (e.Text.IndexOf(''t'') > -1 || e.Text.IndexOf(''T'') > -1))
			int i = int.Parse(cc.Renderer.ControlText);
			i *= 1000;
			cc.Renderer.Control.Text = i.ToString();
			GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl;
			tb.SelectionStart = tb.TextLength;
			e.Cancel = true;
			e.Cancel = true;


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.

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