binding custom editor value to the grid column

2 posts, 0 answers
  1. Guest10
    Guest10 avatar
    9 posts
    Member since:
    Jul 2016

    Posted 16 Dec 2016 Link to this post

    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

     

     

     

  2. Eyup
    Admin
    Eyup avatar
    4071 posts

    Posted 20 Dec 2016 Link to this post

    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.
Back to Top