The telerik for asp.NET Core comes with some EditorTemplates and one of them is Number.cshtml.
I have used the following code <div class="col">@Html.EditorFor(m => m.MeasurementMin)</div> however the generated code is using the String.cshtml template.
When is the template Number.cshtml used? How should the name for the editor template for double be named?
4 Answers, 1 is accepted
To instruct the Grid to use a specific editor for a field, you should set it explicitly.
You can either use the UIHint attribute in the model:
[UIHint(
"Number"
)]
// the string should match the name of the file containing the custom editor
public
double
? Freight
{
get
;
set
;
}
or assign the editor to the column directly:
columns.Bound(p => p.Freight).EditorTemplateName(
"Number"
);
Regards,
Tsvetina
Progress Telerik
Hi,
I forgot I even placed this question. Anyway I tried to rename the Number.cshtml to Double and it worked. Perhaps the String.cshtml template should be renamed so that its not used as default since these templates are custom and should be used in Grid using the solutions you proposed.
Is there a documentation about those templates, because a colleague of mine has placed in the solution all the templates since they came with the telerik and it seems that most of them are not even used by our application.
There is a mention of the templates in the ASP.NET MVC docs here, but not a full description about their usage:
How to use Kendo UI widgets as editors for dates and numbers?
and a brief mention in the description of the ASP.NET Core installation directory here: Distribution Contents.
I logged a suggestion for adding description of the ready-to-use editor templates and their usage to both documentation sites (ASP.NET MVC and Core).
With regard to the slower response time, it is possible to wait longer for replies in the forums. It is indeed more useful for the community to discuss problems in the forums and we appreciate when customers use them. However, should you have a problem which resolution is time sensitive, it is best to open a support ticket, as tickets are treated with higher priority and get replies faster.
Regards,
Tsvetina
Progress Telerik
Hi Tsvetina,
Thank you for the logging of the suggestion. Indeed in the FAQ it says: "To use these editor templates in your application, copy all files from the corresponding folder " so I'm guessing that my colleague has read this and has done as it says.