0
votes

I am using Kendo grid with pop up editing mode and editor template. The editor template consists of a kendo drop down list which is bind through the database and i have inserted the optional label value ie "--select--" at run time in controller which works good for add method but for update method it is not autoselecting the "--select value--" and on click value is selected at second hit. Please help if anyone has any solution to this.

Edited: Please find the below code snippet for my drop down list.

 @(Html.Kendo().DropDownList().Name("Type")
          .DataTextField("Value")
          .DataValueField("TypeID")
          .DataSource(source => 
               {
                   source.Read(read => { read.Action("Action Name", "Controller name"); }); 
               }) 
             )

// Controller code for binding drop down list

 [AllowAnonymous]
          public ActionResult GetTypes()
          {
//my code to get list of types from db in object "Type"
Type.Insert(0, new TypeModel() { Value = "--Select--", TypeID = Guid.Empty });
              return Json(Type, JsonRequestBehavior.AllowGet);
          }
1
Please show us a working jsfiddle/jsbin exampleMohamed Shaaban
Really sorry for that. I can't disclose whole code. The Problem is that how to get a value auto selected in drop down at page load.Manika Agarwal
what version of Kendo UI are you using?Dion Dirza
You should use either an optionLabel or turn autoBind on in dropDownList optionsMohamed Shaaban
@Dion The version is 2015.1.318Manika Agarwal

1 Answers

1
votes

As you said in comment section, Kendo UI 2015 Q1 comes with some new features for dropdown family widget e.g autocomplete, dropdown, multiselect, etc and it also has some bug on it. So its not your fault that the dropdown won't recognize on the first select event. The developer had fixed this issue and release a service pack for this, therefore all you have to do is upgrade or downgrade your Kendo UI version..

See this dojo where the grid's filter doesn't work for the first time selection and if you downgrade its version or upgrade it, it will works fine like in this dojo

Kendo UI 2015 Q1 SP1 Release History, you will see on DropDown section that the issue have been fixed..