How to make a column formated like $20.25 for double

3 posts, 0 answers
  1. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 15 Apr 2011 Link to this post

    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. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 15 Apr 2011 Link to this post

    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
  3. DevCraft banner
  4. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    Perfect.  Thank you
Back to Top