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.
Syncfusion Feedback

How do I supress keystrokes in a month calendar cell?

Thread ID:

Created:

Updated:

Platform:

Replies:

15890 Jun 29,2004 08:03 PM UTC Jun 30,2004 12:28 PM UTC Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 29, 2004 08:03 PM UTC

Hi, I am using 1.6.1.8 DataBoundGrid on VS.NET 2003 on Win2k/XP. I have a DateTime column mapped to "MonthCalendar" cell type in a databound grid. When the user types "t" in the cell, I would like to put todays date in the cell. I am handling ''CurrentCellControlKeyMessage'' event and putting today''s date. But, I see the ''t'' text in the textbox for a fraction of second, and then it changes to today''s date. It does not look good. Is there anyway to supress that ''t'' text all together before I put today''s date? thanks, - Reddy

Administrator [Syncfusion]
Replied On June 29, 2004 08:50 PM UTC

You might try doing this in CurrentCellValidateString.
private void gridDataBoundGrid1_CurrentCellValidateString(object sender, GridCurrentCellValidateStringEventArgs e)
{
	if(e.Text.IndexOf("t") > -1)
	{
		e.Cancel = true;
		GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
		cc.CancelEdit();
		cc.Renderer.Control.Text = DateTime.Now.ToString();
		this.gridDataBoundGrid1.RefreshRange(cc.RangeInfo, true);
	}
}

Administrator [Syncfusion]
Replied On June 30, 2004 05:24 AM UTC

Oops. You also probably want to retrict the code to your MonthCalendar cells.
if(e.Text.IndexOf("t") > -1 
		&& this.gridDataBoundGrid1[cc.RowIndex, cc.ColIndex].CellType == "MonthCalendar")

Administrator [Syncfusion]
Replied On June 30, 2004 12:28 PM UTC

Clay, I don''t know why I did not think of this simple way. It is working very well. thanks, - Reddy

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.

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

;