This is a migrated thread and some comments may be shown as answers.

Grid Column TextEditor as EditorTemplate

1 Answer 394 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vasu
Top achievements
Rank 1
Vasu asked on 11 Mar 2015, 01:32 PM
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" })
)

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 13 Mar 2015, 07:34 AM
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.

Tags
Grid
Asked by
Vasu
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or