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

How to make a column formated like $20.25 for double

2 Answers 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marc Roussel
Top achievements
Rank 2
Marc Roussel asked on 15 Apr 2011, 04:51 PM
I'm struggling to find out how to do simple thing right now like just having one column formated

I'm in the event AutoGeneratingColumn and when I look at e.column.?? there's nothing I see there so I can tell this column to be {0:C2}
Any idea ?

2 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 15 Apr 2011, 06:57 PM
Hi Marc,

 

You may set the DataStringFormat for auto-generated columns in RadGridView as follows:

private void RadGridView1_AutoGeneratingColumn(object sender, Telerik.Windows.Controls.GridViewAutoGeneratingColumnEventArgs e)
        {
            GridViewDataColumn column = e.Column as GridViewDataColumn;
            if (column.DataType == typeof(int))
            {
                column.DataFormatString = "{0:p}";                            
            }
        }

Kind regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 12:56 PM
Perfect.  Thank you
Tags
GridView
Asked by
Marc Roussel
Top achievements
Rank 2
Answers by
Vanya Pavlova
Telerik team
Marc Roussel
Top achievements
Rank 2
Share this question
or