how to use EditorTemplateName?

3 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
    1 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" }
Back to Top