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. Image for the cookie policy date

text not displaying

Hi I have a databound grid that uses a datatable whose columns are of type object. In the datatable are mixed data types. The problem I am having is that string types do not display. Floats, decimal and datetime are ok. I have attached a zip that reproduces the problem. If I print out the values from the preparestyle event g[r,c].CellValue - I can see the strings are in the grid. Can you tell me what I am doing wrong? thanks p.s. if the datacolumn is type string, its fine for strings

2 Replies

AD Administrator Syncfusion Team September 26, 2002 01:51 AM

Andre, I think this is probably a bug. I will submit it so it can be addressed in a release. In the meantime, I think you can get things to behave properly for string cells that have cellvaluetype set to objects, by handling PrepareViewStyleInfo and temporarily explicitly setting the cellvaluetype at that point for this case.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
	if( e.Style.CellValueType == typeof(object) && e.Style.CellValue as string != null)
	{
		e.Style.CellValueType = typeof(string);
	}
}


AK Andre King September 26, 2002 06:12 AM

Thanks for the work around.

Loader.
Live Chat Icon For mobile
Up arrow icon