how to use EditorTemplateName?

7 posts, 0 answers
  1. xu
    xu avatar
    17 posts
    Member since:
    Jul 2010

    Posted 27 Jun 2012 Link to this post

    it's not work,how to use EditorTemplateName?

    columns.Bound(u => u.RoleNameString).EditorTemplateName(


    <script type="text/javascript">

    function roles_editor()







  2. Robert
    Robert avatar
    39 posts
    Member since:
    Feb 2012

    Posted 29 Jun 2012 Link to this post

    EditorTemplateName points to an MVC EditorTemplate, not Javascript. If you want to use JS, you need to use a ClientTemplate for that.

    If you look at C:\Program Files (x86)\Telerik\Kendo UI for ASP.NET MVC Q2 2012 BETA\Examples\Views\Shared\EditorTemplates, you will see some example EditorTemplates that will override the default ASP.NET MVC templates with Kendo behaviors. You can add your own Template for a given model in that folder, and then EditorTemplateName would be the name of the file you want to use. In the case of the examples, you would use .EditorTemplateName("Time") or .EditorTemplateName("Currency").

    Let me know if that is not clear and I can see if I can point to a better example.
  3. Chris
    Chris avatar
    2 posts
    Member since:
    Dec 2012

    Posted 30 May in reply to Robert Link to this post

    This information is wrong or outdated. You can use EditorTemplateName to point to a function like so:

    columns.Bound(o => o.MyColumn).EditorTemplateName("myTemplate");


    function myTemplate(container, options) {
        // create an input element
        var input = $("<input/>");
        // set its name to the field to which the column is bound ('name' in this case)
        input.attr("name", options.field);
        // append it to the container
        // initialize a Kendo UI AutoComplete
            dataTextField: "name",
            dataSource: [
                { name: "Jane Doe" },
                { name: "John Doe" }
  4. Alexandra
    Alexandra avatar
    16 posts
    Member since:
    Sep 2015

    Posted 5 days and 18 hours ago Link to this post

    Hi Telerik Team,

    Has the functionality Chris mentioned worked in the past? How can I achieve that functionality now in MVC? Is my only solution in order to have that functionality to write javascript code?

  5. Alexandra
    Alexandra avatar
    16 posts
    Member since:
    Sep 2015

    Posted 5 days and 18 hours ago in reply to Chris Link to this post

    Sorry Chris but Robert is right. Robert's description is the actual functionality.
  6. Chris
    Chris avatar
    2 posts
    Member since:
    Dec 2012

    Posted 5 days and 17 hours ago in reply to Alexandra Link to this post

    Yes I think you're right; not sure where I got that from at the time.
  7. Stefan
    Stefan avatar
    1155 posts

    Posted 1 day ago Link to this post


    I want to clarify that the description provided by Robert is correct.

    The ClientTemplate can be a function and it is executed on the client to show the data in preview(non-edit) mode:

    The EditorTemplate is pointing to a template(View) which is placed inside the Views\Shared\EditorTemplates folder. This template is used to initialize an editor which will be shown when the column is edited:

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top