Kendo DropDownList in MVC 4

2 posts, 0 answers
  1. pineapple
    pineapple avatar
    1 posts
    Member since:
    Oct 2007

    Posted 14 Feb 2015 Link to this post

    Dear Sir:

    I would like to ask a question in kendo controls

    I filter grid the dropdown auto post back and it doesn't stop on
    selected value that i have chosen, so please I need your advice in it.

    and here's my Code:
    @using Kendo.Mvc.UI;
    @model IEnumerable<OfferEntityFrameworkDB.OfferDetail>
        ViewBag.Title = "List";


       .OptionLabel("Please Select Language ...")
        .HtmlAttributes(new { style = "width:200px;" })
        .DataSource(source => source
        .Transport(transport => transport
        .Read(read =>
          .Events(e =>


    <br />
    <br />
            .Columns(columns =>
                columns.Bound(o => o.OfferID).Hidden();
                columns.Bound(o => o.LanguageID).Hidden();
                columns.Bound(o => o.Name);
                columns.Bound(o => o.Brief);
                columns.Bound(o => o.Desc);
    columns.Template(c => @Html.ActionLink("Edit", "Edit", new { langId =
    c.LanguageID, offerId = c.OfferID })).Title("Edit");
    columns.Template(c => @Html.ActionLink("Delete", "Delete", new {
    langId = c.LanguageID, offerId = c.OfferID })).Title("Delete");


    @section Scripts {
         <script type="text/javascript">
            $(document).ready(function () {
                $("#ddlLang").change(function () {
                    var langId = $("#ddlLang").data().kendoDropDownList.value();
                    var grid = $("#grdOffers").data().kendoGrid;
                    if (langId != null || langId != new Guid("")) {
                        grid.dataSource.filter({ field: "LanguageID", operator: "eq", value: langId });
                    else {

     public ActionResult List()
                List<OfferDetail> lstOfferDetails =  db.OfferDetails.ToList();
                ViewData["OfferData"] = lstOfferDetails;
                return View(ViewData["OfferData"]);
     public JsonResult ComboRead()

                var lstlanguages = from lan in db.Languages select new { Name = lan.Name, ID = lan.ID };

                return Json(lstlanguages, JsonRequestBehavior.AllowGet);


    even sever Controller not working properly when I add data bind to server in the grid.

            List<OfferDetail> lstoffers;
            public JsonResult GetOffersByLangID(Guid? langId)
                lstoffers = (from o in db.OfferDetails where o.LanguageID == langId select o).ToList();
                return Json(lstoffers, JsonRequestBehavior.AllowGet);

    Best Regards,
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 18 Feb 2015 Link to this post


    Based on your explanation and code it seems that you want to refresh the Grid with new data from the server and send that the selection of the DroPDownList to the server. To do so you need to send this value as a regular parameter, instead of trying to filter the Grid by that value.

    How to send extra parameter to the server and refresh the Grid is covered here:

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top