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

DataBoundGrid currency cell type?

How do I change the cell type for a column in a databound grid? Thanks

4 Replies

AD Administrator Syncfusion Team March 16, 2004 02:23 AM

You set the CellType property of the GridBoundColumn.StyleInfo of that column. Here is a KB link that shows code to set BackColor. http://www.syncfusion.com/Support/article.aspx?id=562 You would do the same for CellType. If you want the CellType to be "Currency", then you may need to set other properties as shown in the Grid\Samples\CellTypes\Currency sample.


AD Administrator Syncfusion Team March 16, 2004 05:34 PM

I set the celltype like you said but it just throws an exception now... I looked at that example and it only looks like it works for a GridControl... Am I missing something? Is there a way to loop thorugh the values displayed so I can set there celltype and cellvalue appropriately in a DataBoundGrid? >You set the CellType property of the GridBoundColumn.StyleInfo of that column. Here is a KB link that shows code to set BackColor. > >http://www.syncfusion.com/Support/article.aspx?id=562 > >You would do the same for CellType. If you want the CellType to be "Currency", then you may need to set other properties as shown in the Grid\Samples\CellTypes\Currency sample.


AD Administrator Syncfusion Team March 16, 2004 05:47 PM

I tried adding the following code and each call to the StyleInfo causes an error saying Object not set to an instance of an object... this.ticketGrid.GridBoundColumns["Face"].StyleInfo.CellValueType = typeof(double); this.ticketGrid.GridBoundColumns["Face"].StyleInfo.CellValue = 1; this.ticketGrid.GridBoundColumns["Face"].StyleInfo.CellType = "C"; this.ticketGrid.GridBoundColumns["Face"].StyleInfo.StrictValueType = false;


AD Administrator Syncfusion Team March 16, 2004 05:56 PM

What kind of values are coming from your DataSource? Here is code that works for double values coming from the datasource in the attached sample. Dim style As GridStyleInfo = Me.gridDataBoundGrid1.Binder.InternalColumns("$amount").StyleInfo style.CellType = "Currency" style.CurrencyEdit.ClipMode = Syncfusion.Windows.Forms.Tools.CurrencyClipModes.ExcludeFormatting forum11780_1942.zip

Loader.
Live Chat Icon For mobile
Up arrow icon