Drop Down List with AJAX

4 posts, 0 answers
  1. Richard
    Richard avatar
    4 posts
    Member since:
    Oct 2012

    Posted 13 Dec 2012 Link to this post

    I am trying to load a drop down list, with data from AJAX.   When it loads, I get the "waiting" circle over the list continually.  I looked at the example, and noticed the same behavior.

    View Code:
    <fieldset class="form-list"> <ol> <li> <label>Project *</label> @(Html.Kendo().DropDownList()   .Name("1Project")   .DataTextField("DisplayName")   .DataValueField("ProjectID")   .DataSource(source =>   {   source.Read(read =>   {   read.Action("ProjectList""ReturnMail");   });   }) ) </li> <li> <label>Name Address 1</label> <input type="text" id="1NameAddress1" class="k-textbox" /> </li> <li> <label>Name Address 1</label> <input type="text" id="1NameAddress2" class="k-textbox" /> </li> <li> <label>Name Address 1</label> <input type="text" id="1NameAddress3" class="k-textbox" /> </li> <li> <label>Name Address 1</label> <input type="text" id="1NameAddress4" class="k-textbox" /> </li> <li> <label>Name Address 1</label> <input type="text" id="1NameAddress5" class="k-textbox" /> </li> <li> <label>City</label> <input type="text" id="1City" class="k-textbox" /> </li> <li> <label>State</label> <input type="text" id="1State" class="k-textbox" maxlength="2" /> </li> <li> <label>&nbsp;</label> <button id="SearchAddressButton" class="k-button primary">Search</button> </li> </ol> </fieldset> 

    Controller Code:
    public JsonResult ProjectList(string userName = "") { if (userName == "") userName = Request.ServerVariables["AUTH_USER"]; List<ProjectModel> proj = ProjectModel.AllProjects(); return Json(proj); } 
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 14 Dec 2012 Link to this post

    Hello Richard,

     
    If the load image continues to spin, then I believe there is a server error. You can use web developer tool (FireFox etc.) to validate this. Nevertheless I believe the problem is in the 

    return Json(proj);
    As you probably know the ASP.NET MVC does not allow GET requests and you will need to define second parameter JsonRequestBehavior.AllowGet.

    Regards,
    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. UI for ASP.NET MVC is VS 2017 Ready
  4. Jason
    Jason avatar
    8 posts
    Member since:
    Aug 2012

    Posted 17 Dec 2012 Link to this post

    I've spent hours resolving issues embedding drop-down lists into grids.

    Perhaps if Telerik fixed the samples it would help :/

    This one doesn't include the controller:
    http://demos.kendoui.com/web/dropdownlist/remotedatasource.html

    This one has source for an unrelated example:
    http://demos.kendoui.com/web/grid/editing-custom.html

    Moving to KendoUI has been agonizing for us, primarily because the documentation and examples have been so lacking compared to the original MVC version.
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 18 Dec 2012 Link to this post

    Hello Jason,

     
    Consolidation of the demos for the different technologies is in our TODO list for the upcoming official release of Kendo UI. If you have any suggestions about the Kendo UI documentation, please share them. Thus we will be able to improve it in the right direction. Also there are tutorials, which covers the migration path between Telerik Extensions for ASP.NET MVC and Kendo UI Complete for ASP.NET MVC.

    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!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready