How to add the custom dropdownlist selected value in the grid

218 Views Asked by At

When we try to add a new record in the grid, Instead of textboxes I added dropdown kendo control in one column. The update custom button is not adding the selected dropdown value in the grid. Also, I added hardcoded values in the kendo dropdown list

@(Html.Kendo().Grid<IntegrationViewModel>()
        .Name("IntegrationItemSettingsGrid")
        .Columns(columns =>
        {
            columns.Bound(p => p.IntegrationType).Title("Integration Type").Width(50);
            columns.Bound(p => p.ClinetId).Title("Clinet ID").Width(70);
            columns.Bound(p => p.ClientSecret).Title("Client Secret").Width(150);
            columns.Command(command =>
            {
                command.Edit();
                command.Destroy();
                command.Custom("Test").Click("TestConnection");  //here
            });
        }).ToolBar(toolbar => toolbar.Create())
  .Editable(editable => editable.Mode(GridEditMode.InLine))
  .Sortable(sortable => sortable.AllowUnsort(false))
  .Pageable(pageable => pageable.Enabled(false))
  .HtmlAttributes(new { style = "width:100%;" })
 .DataSource(dataSource => dataSource.Ajax()
 .Model(model => model.Id(e => e.ClinetId))
 .Create(update => update.Action("CreateIntegration", "Admin"))
 .Read(read => read.Action("ReadIntegType", "Admin"))
 .Destroy(update => update.Action("DeleteIntegration", "Admin"))
 .Update(update => update.Action("UpdateIntegration", "Admin"))
 .Events(events => events.Error("onError"))))

Added kendo dropdown code in an Editor template

@(Html.Kendo().DropDownList()
.Name("Type")
.DataTextField("Text")
.DataValueField("Value")
.OptionLabel("-Select from list-")
.BindTo(new List<SelectListItem>()
                    {
                        new SelectListItem()
                        {
                            Text = "Hello there",
                            Value = "Hello there"
                        }
                    }
))

Clicked Add new record button to add record

Selected type from dropdown list and clicked update button. Other two-columns data was added in the grid but the dropdown value is not

Am I missing anything? or Is there any way that the custom command Update button could know the selected value of dropdownlist to add in the grid?

0

There are 0 best solutions below