Removing comma from IntegerTextBoxFor

1.1k Views Asked by At

I have a question about the IntegerTextBoxFor from Telerik Extensions for MVC. I'm currently trying to remove the use of commas from it. Currently here is what I have.

Editor Template called Int32.cshtml

@model System.Int32
@using Telerik.Web.Mvc.UI

@Html.Telerik().IntegerTextBoxFor(model => model)

Model

[NopResourceDisplayName("Admin.ReturnRequest.List.SearchOrderId")]
public int SearchOrderId { get; set; }

I have tried adding [DisplayFormat(DataFormatString="{0:g}")] to the model but it has done nothing. I also tried using 0:#####, 0:00000, and 0:n.

2

There are 2 best solutions below

0
nemesv On BEST ANSWER

You can configure the group separator with calling the NumberGroupSeparator method on the IntegerTextBoxFor(model => model).

So if you don't need the separator you can set it to the empty string:

@Html.Telerik().IntegerTextBoxFor(model => model).NumberGroupSeparator("")
0
JNeo On

Telerik don't have this "NumberGroupSeparator" method on Kendo UI.

@(Html.Kendo().IntegerTextBoxFor(model => model)