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

binding custom editor value to the grid column

1 Answer 352 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Guest10
Top achievements
Rank 1
Guest10 asked on 16 Dec 2016, 07:16 PM

Hi,

 

I have following kenodgrid

 

(Html.Kendo().Grid<SSAIFCN.Domain.evViewModel>()
        .Name("evGrid")
        .Columns(columns =>
        {
            columns.Bound(x => x.evId).Visible(false);
            columns.Bound(x => x.PId).Title("Company").HeaderHtmlAttributes(new { style = "white-space: normal" }).EditorTemplateName("PEEditor")  .ClientTemplate("#=CompanyName#")

  columns.Command(command =>
            {
                command.Edit();
                command.Destroy();
            });

 .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))

.DataSource(dataSource => dataSource
           .Ajax()

 .Create(update => update.Action("CreateEV", "EVController"))

 

------------------PEEditor.cshtml

@model object

@(Html.Kendo().ComboBoxFor(m => m)
    .DataTextField("PEtext")
    .DataValueField("PEID")
     .Placeholder("--Select--")
     .DataSource(source =>
     {
         source.Read(read =>
         {
             read.Action("GetPEData", "EVController"); //Set the Action and Controller names.
         });
     })

 

---------------- CreateEV controller

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult CreateEV([DataSourceRequest] DataSourceRequest request, evViewModel evt)

{

// create code here

}

 

Dropdown shows value perfectly in edit mode

Question: when I select he values and update/create the record I don't see any value in "evt.PID ". it is null.

In other words how do I get the value selected in dropdown  to model grid and pass on create action

 

Thanks for your help

 

 

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 20 Dec 2016, 02:30 PM
Hi,

I've replied to your query in the following post:
http://www.telerik.com/forums/combox-in-kendo-grid

I suggest that we continue our conversation on the mentioned thread.

Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Guest10
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or