Kendo MVC Dropdownlistboxfor - how to send a post for updating model to the controller

2 posts, 0 answers
  1. Arul
    Arul avatar
    11 posts
    Member since:
    Oct 2014

    Posted 05 Nov 2014 Link to this post

    I am new to using Kendo UI. I am using MVC4  (VS 2012) with Kendo Mvc wrappers. I am trying to display a DropdownlistboxFor associated with a model item. Then during listbox change event i want to save that model (in the controller). I have hardcoded listbox items added to the listbox like in the code below. Should i post an ajax call which will call a controller method that saves model? How do i do this ajax post with model data sent to the controller action with the combo box updated data?

    Is there any other way?
    Thank you so much for your help.

    My model code is:
    public class PackageModelView
            public int DefaultReason { get; set; }
    View code (say named file Package.cshtml) has:
    @using .<model namespace directory>
    @model PackageModelView

    @(Html.Kendo().DropDownListFor(model => model.DefaultAction)
                            .BindTo(new List<SelectListItem>()
                                new SelectListItem()
                                    Text = "Active",
                                    Value = "1"
                                new SelectListItem()
                                    Text = "In-active",
                                    Value = "2"

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 07 Nov 2014 Link to this post

    Hello Arul,

    You should proceed the same way as you would do if you are using a regular form element with select list inside or an ajax form.

    Or through jQuery:

    The name attribute of the window is automatically assigned to be the same as the property name that you are going to edit.

    Kind Regards,
    Petur Subev

    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.

Back to Top