Grid Column TextEditor as EditorTemplate

2 posts, 0 answers
  1. Vasu
    Vasu avatar
    14 posts
    Member since:
    Jan 2006

    Posted 11 Mar 2015 Link to this post

    Hi,

    I am trying to use TextEditor as the EditorTemplate for Grid.  When I click on Edit the column value is not being passed on the editor.  Not sure what I am doing wrong.  Any help is appreciated.

    @(Html.Kendo()
          .Grid<WellsRxWeb.Models.UserNotesModel>()
          .Name("gridUserNotes")
          .Columns(columns => {
            columns.Bound(p => p.NotesId).Title("Id").Visible(false);
            columns.Bound(p => p.UserName).Title("UserName").Visible(false);
            columns.Bound(p => p.UserNoteText).Title("Notes").EditorTemplateName("TextEditor");
            columns.Bound(p => p.ModifiedBy).Title("Saved By");
            columns.Bound(p => p.Modified).Title("Saved").Format("{0:MM/dd/yyyy}");
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
          })
          .ToolBar(toolbar => { toolbar.Create(); })
          .Editable(editable => editable.Mode(GridEditMode.InLine))
          .Pageable()
          .Sortable()
          .Filterable()
          .Pageable(pageable => pageable
                                        .Refresh(true)
                                        .PageSizes(true)
                                        .ButtonCount(5))
          .Filterable()
                  .Reorderable(r => r.Columns(true))
            .Resizable(r => r.Columns(true))
            .ColumnMenu()
     
          .DataSource(dataSource => dataSource
                                              .Ajax()
                                              .Model(model => {
                                                model.Id(o => o.NotesId);
                                                model.Field(p => p.UserName).Editable(false);
                                                model.Field(p => p.ModifiedBy).Editable(false);
                                                model.Field(p => p.Modified).Editable(false);                                           
                                              })
                                              .Read(read => read.Action("UserNotes_Read", "User").Type(HttpVerbs.Get).Data("additionalData"))
                                              .Create(create => create.Action("UserNotes_Create", "User").Data("additionalData"))
                                              .Update(update => update.Action("UserNotes_Update", "User").Data("additionalData"))
                                              .Destroy(destroy => destroy.Action("UserNotes_Destroy", "User").Data("additionalData").Type(HttpVerbs.Post))
                                              .Events(events => { events.RequestEnd("gridRequestEnd"); }))
     
    )

    TextEditor.cshtml
    @model WellsRxWeb.Models.UserNotesModel
     
    @(Html.Kendo().EditorFor(model => model.UserNoteText)
          .Name("TextEditor")
          .HtmlAttributes(new { style = "width: 740px;height:440px" })
    )
  2. Dimo
    Admin
    Dimo avatar
    8456 posts

    Posted 13 Mar 2015 Link to this post

    Hello Sreenivasa,

    Please do not post duplicate support tickets and forum threads.

    The Kendo UI Editor has a Name(), which is different from the model field name. This can't work. Please remove the Name(), as it is not needed in this case.

    http://docs.telerik.com/kendo-ui/aspnet-mvc/fundamentals#configuration-Name

    http://docs.telerik.com/kendo-ui/aspnet-mvc/troubleshooting#widgets-value-is-not-bound-to-the-models-property

    Regards,
    Dimo
    Telerik

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top