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.

How do I supress keystrokes in a month calendar cell?

Thread ID:





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

Hi, I am using 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 04:50 PM

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.Renderer.Control.Text = DateTime.Now.ToString();
		this.gridDataBoundGrid1.RefreshRange(cc.RangeInfo, true);

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

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 08:28 AM

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


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.