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

Evaluating Essential Suite

Thread ID:

Created:

Updated:

Platform:

Replies:

3853 Apr 14,2003 11:16 AM UTC Apr 14,2003 06:59 PM UTC WinForms 2
loading
Tags: GridControl
Jeremy Holt
Asked On April 14, 2003 11:16 AM UTC

I am in the process of evaluating the Essential Grid, and would appreciate some additional information. In my own very primitive "home rolled" grid I override OnPaint of a datagridcolumnstyle and have a user supplied format. The Commit is also overridden to parse the formatted text before committing it to the datasource. An example: Raw data 1/3/2003 - formatted as Mar 03 Raw data 2/3/2003 - formatted as M/A 03 Raw data 1/9/2003 - formatted as Sep 03 Raw data 2/9/2003 - formatted as S/O 03 Raw data 0 - formatted as "C" Raw data 1 - formatted as "S" etc etc. My questions is if it is possible to do something similar with the Essential Grid. Another question - my computer is set up for CultureInfo GB - i.e. UK date, dd/mm/yyyy. While the data in the grid correctly shows the UK date format, entering a partial date with UK format throws an invalid date format error, ie. 29/3 (the standard grid will complete this to 29th March 2003 even if the year has not been supplied), but the Essential Grid balks at the date. Many thanks in advance Jeremy Holt

Administrator [Syncfusion]
Replied On April 14, 2003 02:44 PM UTC

In regard to your second question, if you do not explicilty set teh GridStyleInfo.Format for the cell, then you can type something like 4/4 and teh grid will populate the missing datetime information. But if you provide the format, then the grid uses the ParseExact to enforce the format. One way around this is to handle CurrentCellValidating and take the incoming string and populate it properly so there are no missing pieces.
//in form load
this.gridControl1.ColWidths[2] = 120;
GridStyleInfo style = this.gridControl1[2,2];
style.BackColor = Color.LightBlue;
style.CellValue = DateTime.Now;
style.CellValueType = typeof(DateTime);
style.Format = "g";

private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	GridStyleInfo style = this.gridControl1[cc.RowIndex, cc.ColIndex];
	if(style.Format.Length > 0 && style.CellValueType == typeof(DateTime))
	{
		string val = cc.Renderer.ControlText;
		try
		{
			DateTime dt = DateTime.Parse(val); //takes almost anything
			val = dt.ToString(style.Format); //force it to the desired format
			cc.Renderer.Control.Text = val; //set it into the control
		}
		catch
		{} //empty catch
	}
}              
With respect to your first question, our upcoming 1.6 release has two new events designed to handle exactly this task, QueryCellFormattedText and SaveCellFormattedText. 1.6 goes into beta this week.

Jeremy Holt
Replied On April 14, 2003 06:59 PM UTC

Clay Thanks very much for the info Regards Jeremy

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;