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

ColorEdit in cell does not work if the cellvalue is invalid

Thread ID:

Created:

Updated:

Platform:

Replies:

11044 Feb 21,2004 10:03 PM UTC Feb 22,2004 11:47 AM UTC WinForms 2
loading
Tags: GridControl
Babu Mannaravalappil
Asked On February 21, 2004 10:03 PM UTC

Hi, I have a GridDataBoundGrid and a couple of columns of which are of type ColorEdit. If I edit the cell value directly (not by color pallette dropdown) and change the string to something that cannot be converted to a valid color, the cell does accept the value. But then, clicking the dropdown button for the color palette does not work. The same thing happens if I change the column value in the datasource table manually and try to click on the dropdown for the corresponding cell. Is there a workaround for this please? Babu.

Administrator [Syncfusion]
Replied On February 22, 2004 08:21 AM UTC

Try handling CurrentCellValidateString, and set e.Cancel = true if the color is not valid.
private void gridDataBoundGrid1_CurrentCellValidateString(object sender, GridCurrentCellValidateStringEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(this.gridDataBoundGrid1[cc.RowIndex, cc.ColIndex].CellType == "ColorEdit")
	{
		string s = e.Text;
		try
		{
			Color c = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(s); 
		}
		catch
		{
			e.Cancel = true;
		}
	}
}

Babu Mannaravalappil
Replied On February 22, 2004 11:47 AM UTC

Thanks Clay. It is really exhilerating to find that here is a forum where all my questions get attended to so very fast and answered with working solutions. Thanks again and keep it up. Babu.

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

;