Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:32:58+00:00 2026-06-06T02:32:58+00:00

I’m working with KendoUI MVC in MVC3. I managed to get a dropdown in

  • 0

I’m working with KendoUI MVC in MVC3.

I managed to get a dropdown in a grid column. But I have no clue on how to set the selected value, and when I save it doesn’t save my selected value.

The grid

@using Perseus.Areas.Communication.Models
@using Perseus.Common.BusinessEntities;


<div class="gridWrapper">
    @(Html.Kendo().Grid<CommunicationModel>()
        .Name("grid")
        .Columns(colums =>
        {
            colums.Bound(o => o.communication_type_id)
                .EditorTemplateName("_communicationDropDown")
                .ClientTemplate("#: communication_type #")
                .Title("Type")
                .Width(180);
            colums.Bound(o => o.sequence).Width(180);
            colums.Bound(o => o.remarks);
            colums.Command(command => command.Edit()).Width(50);
        })
        .Pageable()
        .Sortable()
        .Filterable()
        .Groupable()
        .Editable(edit => edit.Mode(GridEditMode.InLine))
        .DataSource(dataSource => dataSource
            .Ajax()
            .ServerOperation(false)
            .Model(model => model.Id(o => o.communication_id))
                .Read(read => read.Action("AjaxBinding", "Communication", new { id = @ViewBag.addressId }))
                .Update(update => update.Action("Update", "Communication"))
            .Sort(sort => { sort.Add(o => o.sequence).Ascending(); })
            .PageSize(20)
        )
    )
</div>

The EditorTemplate “_communicationDropDown

@model Perseus.Areas.Communication.Models.CommunicationModel


@(Html.Kendo().DropDownListFor(c => c.communication_type_id)
        .Name("DropDownListCommunication")
            .DataTextField("description1")
            .DataValueField("communication_type_id")
            .BindTo(ViewBag.CommunicationTypes))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:33:00+00:00Added an answer on June 6, 2026 at 2:33 am

    I think this is an important one to point out is that the DropDownList name should match the column name attribute. The html attribute name=””, not the heading of the column. The name attributes must match for this to work, since you are substituting the default editor control with another control coming from an editor template to take its place during the edit operation. If the names do not match when the DOM is serialized back into the model for the update operation, the value from the editor template control will be ignored. By default it is the property variable name that appears in the model class, unless overriden in the mark up.

    (Answer edited to include the insert record operation).

    Here is a working example:

    Model Class:

    public class Employee
    {
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public string Department { get; set; }
    }
    

    View:

    @(Html.Kendo().Grid<Employee>()
         .Name("Grid")
         .Columns(columns =>
         {
             columns.Bound(p => p.Name).Width(50);
             columns.Bound(p => p.Department).Width(50).EditorTemplateName("DepartmentDropDownList");
             columns.Command(command => command.Edit()).Width(50);
         })
         .ToolBar(commands => commands.Create())
         .Editable(editable => editable.Mode(GridEditMode.InLine))
         .DataSource(dataSource => dataSource
             .Ajax() 
             .Model(model => model.Id(p => p.EmployeeId))
             .Read(read => read.Action("GetEmployees", "Home")) 
             .Update(update => update.Action("UpdateEmployees", "Home"))
             .Create(create => create.Action("CreateEmployee", "Home"))
         )
    )
    

    Partial view editor template, file name “DepartmentDropDownList”, located in the EditorTemplates folder that is specific to this view. ie. Home\Views\EditorTemplates\DepartmentDropDownList.cshtml

    @model string
    
    @(Html.Kendo().DropDownList()
        .Name("Department")  //Important, must match the column's name
        .Value(Model)
        .SelectedIndex(0)
        .BindTo(new string[] { "IT", "Sales", "Finance" }))  //Static list of departments, can bind this to anything else. ie. the contents in the ViewBag
    

    Controller for the Read operation:

    public ActionResult GetEmployees([DataSourceRequest]DataSourceRequest request)
    {
        List<Employee> list = new List<Employee>();
        Employee employee = new Employee() { EmployeeId = 1, Name = "John Smith", Department = "Sales" };
        list.Add(employee);
        employee = new Employee() { EmployeeId = 2, Name = "Ted Teller", Department = "Finance" };
        list.Add(employee);
    
        return Json(list.ToDataSourceResult(request));
    }
    

    Controller for the Update operation:

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult UpdateEmployees([DataSourceRequest] DataSourceRequest request, Employee employee)
    {
        return Json(new[] { employee }.ToDataSourceResult(request, ModelState));
    }
    

    Controller for the Create operation:

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult CreateEmployee([DataSourceRequest] DataSourceRequest request, Employee employee)
    {
        employee.EmployeeId = (new Random()).Next(1000);  
        return Json(new[] { employee }.ToDataSourceResult(request, ModelState));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.