Setting default value in kendogrid from JSON data

2 posts, 0 answers
  1. Lloyd
    Lloyd avatar
    4 posts
    Member since:
    Feb 2012

    Posted 15 Sep 2015 Link to this post

     Please find the below code as i want to set default value of dropdown instead of optionlable from  JSON data which is returned from controller .

    Please find the below code



                  .HtmlAttributes(new { style = "width:300px" })
                  .OptionLabel("Select ...")
                          .DataSource(source =>
                   source.Read(read =>
                          read.Action("GetOrders", "IDTDashboard");


    public ActionResult GetOrders()
               List<usp_IDQ_GetLicenseDistrictsVO> objresult1 = new List<usp_IDQ_GetLicenseDistrictsVO>();
               objresult1 = objConnection.usp_IDQ_GetLicenseDistricts(User.Identity.Name, true).ToList();
               return Json(objresult1, JsonRequestBehavior.AllowGet); ;

  2. Georgi Krustev
    Georgi Krustev avatar
    3725 posts

    Posted 17 Sep 2015 Link to this post

    Hello Lloyd,

    Probably, I am missing something, but you can set the selected value of the widget using its Value method or defining the selected index. The code should looks something like this:
        .Value("selected value is passed here")

    Could you elaborate a bit more on the scenario if I missed the point?

    Georgi Krustev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top