This is a migrated thread and some comments may be shown as answers.

FORMATTING A NUMBER IN A GRIDVIEW COLUMN

1 Answer 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sarah
Top achievements
Rank 1
Sarah asked on 09 Jan 2012, 09:35 PM
Hi,
I would like to know,how should i go about formatting a decimal number in a column. I know DataFormatString="{}{0:c}" should be used in the XAML to format.But the problem is, my rad grid view loads data from different tables in the data base according to certain search paramters at run time, meaning dynamically.So unless the data is loaded i would not know which are the columns to be formatted.So I need help to know to fix the same.
Thanks,
Sarah

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 10 Jan 2012, 07:06 AM
Hello Sarah,

You can set the DataFormatString property in the code-behind as follows:

(this.clubsGrid.Columns[2] as GridViewDataColumn).DataFormatString = "{0:C}";



Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Sarah
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or