How to set the Combo box Value

3 posts, 0 answers
  1. Vikas
    Vikas avatar
    1 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2012 Link to this post


    I'm new to Kendo controls. We are replacing the existing MVC controls with Kendo Controls. 

    The existing MVC controls looks like below
     @Html.DropDownListFor(model => model.value, new SelectList(ViewBag.list, "id", "label"))

    I can able to load the data but not able to set the value like above. Please suggest to set the value. Below is my Kendo control. It has the Value property but doesn't allow model values in it.

  2. Georgi Krustev
    Georgi Krustev avatar
    3725 posts

    Posted 24 Jul 2012 Link to this post

    Hello Vikas,

    I will suggest you use the ComboBoxFor, as it provides the same functionality as the Html.DropDownListFor:

    @(Html.Kendo().ComboBoxFor(model => model.value)
    All the best,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Marius
    Marius avatar
    2 posts
    Member since:
    Aug 2012

    Posted 29 Aug 2012 Link to this post

    @(Html.Kendo().ComboBoxFor(model => model.GeoGroupCountryId)

    //if you have problem whit circular reference...
     ViewBag.list= geocountry.Select(g => new { Name = g.GeoGroup.Name, GeoGroupId = g.GeoGroupId });

                                        @( Html.Kendo().ComboBoxFor(model => model.GeoGroupCountryId)
                                    .Placeholder("All Countries")
                                    .HtmlAttributes(new { style = "width: 200px;" })
                                    .DataSource(source => { source.Read(read => {      read.Action("GetGeoGroupCountry", "GeoGroupPostalCode"); }).ServerFiltering(true); })
            public JsonResult GetGeoGroupCountry()
                var geocountry = _geoGroupService.GetAll<GeoGroupCountry>();
                return Json(geocountry.Select(g => new { Name = g.GeoGroup.Name, GeoGroupId = g.GeoGroupId }), JsonRequestBehavior.AllowGet);
Back to Top