2

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.

IyaTaisho
  • 863
  • 19
  • 42
  • 1
    @JasonEvans I think problem is related to UI. When Telerik IntegerTextBoxFor get used to display SearchOrderId it try to format number with DecimalSeparator. – dotnetstep Apr 14 '14 at 14:10
  • 1
    You can try to set the `NumberGroupSeparator` to `""` with `@Html.Telerik().IntegerTextBoxFor(model => model).NumberGroupSeparator("")` – nemesv Apr 14 '14 at 14:51
  • @JasonEvans Why do the work that Telerik already did? It would be reinventing the wheel for no reason. – IyaTaisho Apr 14 '14 at 14:52
  • Thank you @nemesv! It worked right away. Go ahead and post the answer and I'll give you credit. Thanks again! – IyaTaisho Apr 14 '14 at 14:54

2 Answers2

1

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("")
nemesv
  • 138,284
  • 16
  • 416
  • 359
0

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

@(Html.Kendo().IntegerTextBoxFor(model => model)
NorthCat
  • 9,643
  • 16
  • 47
  • 50
JNeo
  • 1