New to Telerik UI for ASP.NET Core? Start a free 30-day trial
Removing Spinners from NumericTextBox Editors in the Grid
Updated over 6 months ago
Environment
| Product | Telerik UI for ASP.NET Core Grid |
| Product Version | 2017.3.913 |
Description
How can I remove the spinners (up and down arrows) from the editor of a "[DataType("Integer")]" field in the Telerik UI for ASP.NET Core Grid?
Solution
-
Under
Views/Shared/EditorTemplates, add a.cshtmlfile with the following definition.NoSpinners.cshtmlRazor@model int? @(Html.Kendo().NumericTextBoxFor(m => m) .HtmlAttributes(new { style = "width:100%" }) .Spinners(false) ) -
Open the model that you are editing in the Grid.
-
Add a
[UIHint("NoSpinners")]annotation to the integer field which does not show spinners.Razor[DisplayName("Units in stock")] [UIHint("NoSpinners")] [Range(0, int.MaxValue)] public int UnitsInStock { get; set; } -
Make sure that the
NoSpinnersstring matches the name of the editor template file.
To see the end result, refer to this screenshot.