Telerik: Formatting a GridNumericColumn to not show a comma

2.1k Views Asked by At

I have a year column in a RadGrid. When I edit the column inline, it's showing a comma. Can the GridNumericColumn be formatted to not show a comma? If so, how is this done please?

I've tried changing the datatype to various things, but I haven't been able to get it to work. I'd like to keep this out of the code behind if at all possible.

enter image description here

            <telerik:GridNumericColumn DataField="YearFrom" HeaderText="Year From" SortExpression="YearFrom" UniqueName="YearFrom" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" MaxLength="4" MaxValue="9999" MinValue="0" DataType="System.Decimal">
            </telerik:GridNumericColumn>
2

There are 2 best solutions below

1
On

Use the property DataFormatString and use the following code.

<telerik:GridNumericColumn 
    DataField="YearFrom" 
    HeaderText="Year From" 
    SortExpression="YearFrom" 
    UniqueName="YearFrom" 
    ItemStyle-HorizontalAlign="Center" 
    HeaderStyle-HorizontalAlign="Center" 
    MaxLength="4" MaxValue="9999" 
    MinValue="0" 
    DataType="System.Decimal"
    DataFormatString="{0:0}">
</telerik:GridNumericColumn>
0
On

Dataformat string for Radgrid telerik

Dataformat string for Radgrid telerik