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.


Thread ID:





2251 Dec 23,2002 12:27 PM Dec 23,2002 01:33 PM Windows Forms 1
Tags: GridControl
Doug Finke
Asked On December 23, 2002 12:27 PM

Using a databound grid, I create columns on the fly. I then bind the grid. If I do _not_ set the StyleInfo.Format, the grid correctly sets the StyleInfo.CellValueType. At runtime, setting the StyleInfo.Format and re-applying it to the grid: DataBoundGrid.Binder.InternalColumns.Clear(); . . Build and Add DataBoundColumns; . . DataBoundGrid.Binder.InitializeColumns(); The cell data displays the new format correctly but the StyleInfo.CellValueType is blank. I need know the StyleInfo.CellValueType.

Administrator [Syncfusion]
Replied On December 23, 2002 01:33 PM

The GridDataBoundGrid only sets the StyleInfo properties if you have not any of the StyleInfo properties. This avoids the initialization code stepping on settings that you set. Here is the code segment from the _InitGridColumn method in our source.
void _InitGridColumn(GridBoundColumn gcs, PropertyDescriptor pd) 
	bool autoInitCellType = GridModelDataBinder.AutoInitCellTypes;
	gcs.PropertyDescriptor = pd;
	Type type = pd.PropertyType;
	if (gcs.StyleInfo.IsEmpty)
		gcs.StyleInfo.CellValueType = pd.PropertyType;
		if (type.Equals(typeof(Boolean)))
So, if you set any properties in the StyleInfo, the CellValueType is not set. One thing you could try is to postpone setting the Format property until after the call to Binder.Initialize columns to see if that will allow the CellValueType to be set by the initialization. Another option would be for you to explicitly set the CellValueType at the same point that you set the Format.


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.