How could i get selected value from dropdownlist in kendo ui grid in mvc

3 posts, 0 answers
  1. Varma
    Varma avatar
    1 posts
    Member since:
    Sep 2010

    Posted 14 Jul 2012 Link to this post

    I am working on Kendo UI with mvc razor. I am trying to bind database table data with kendo grid that supports CRUD operations. Here i need to populate a dropdownlist for one of my table field. I have used the following code


        @model IEnumerable<MvcApplication1.PriceOption>    
                .Columns(columns =>
                    //columns.Bound(p => p.ProductTitle).ClientTemplate("<input type='checkbox' disabled='disabled'name='Discontinued' <#= Discontinued? checked='checked' : '' #> />");
                    columns.Bound(p => p.ProductTitle).EditorTemplateName("OptionalEmail");
                    columns.Bound(p => p.OptionTitle);
                    columns.Bound(p => p.Price);
                    columns.Bound(p => p.Frequency);
                    columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
                .ToolBar(toolbar => toolbar.Create())
                    .Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
                .DataSource(dataSource => dataSource
                    .Events(events => events.Error("error_handler"))
                    .Model(model => model.Id(p => p.ProductID))
                    .Create(create => create.Action("CreateOption", "ZiceAdmin"))
                    .Read(read => read.Action("Read", "ZiceAdmin"))
                    .Update(update => update.Action("UpdateOption", "ZiceAdmin"))
                    .Destroy(update => update.Action("DeleteOption", "ZiceAdmin"))


        @model string
            .BindTo(new SelectList(ViewBag.ProductTitle))

    Here i need to store the selected item from the dropdownlist. But it always shows null. How could i get the selected value from dropdownlist.
  2. Rosen
    Rosen avatar
    3247 posts

    Posted 18 Jul 2012 Link to this post

    Hi Varma,

    Could you please modify the Editor template DropDownList configuration similar to the following:

            .BindTo(ViewBag.ProductTitle) // an collection of entries which have a Title property

    Also an example of similar custom editor could be found in the demo samples (under Grid->Editing custom editor) available within  the KendoUI for ASP.NET MVC distribution package.Regards,
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Gibi
    Gibi avatar
    3 posts
    Member since:
    Oct 2008

    Posted 17 Sep 2012 Link to this post

    The demo code is not what demo is. Check it out.
Back to Top