Edit this page

Data Formatting

GridViewDataColumn and GridViewComboBoxColumn allow you to format the displayed data. To do that you have to specify an appropriate format string setting it as DataFormatString for the column.

XAML

<telerik:GridViewDataColumn DataMemberBinding="{Binding OrderDate}"
                Header="Order Date"
                UniqueName="OrderDate"
                DataFormatString="{} {0:dd, MMM, yyyy}" />

Defining format strings in XAML can be done in the following way- {}:{0:your format string}.

C#

((GridViewDataColumn)this.radGridView.Columns["OrderDate"]).DataFormatString = "{0:dd, MMM, yyyy}";
// or
((GridViewDataColumn)this.radGridView.Columns["OrderDate"]).DataFormatString = "dd, MMM, yyyy";

VB.NET

DirectCast(Me.radGridView.Columns("OrderDate"), GridViewDataColumn).DataFormatString = "{0:dd, MMM, yyyy}"
' or
DirectCast(Me.radGridView.Columns("OrderDate"), GridViewDataColumn).DataFormatString = "dd, MMM, yyyy"

DataFormatString is plain string.Format. To learn more please check this MSDN article:
string.Format

{} is the XAML escape sequence. You can find again more information in MSDN:
Escape Sequence

To learn more about formatting visit the Formatting Overview chapter in MSDN.

See Also