This is a migrated thread and some comments may be shown as answers.

Drop down list doesn't load from json result

1 Answer 143 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Pritam
Top achievements
Rank 1
Pritam asked on 29 May 2013, 02:13 PM
Drop down list is continously showing the loading sign

I have the following model deliverable type

public partial class t_deliverable_type_mst
    {
        public t_deliverable_type_mst()
        {
            this.t_deliverable_item_mst = new HashSet<t_deliverable_item_mst>();
        }
    
        public int pk_d_type_id { get; set; }
        public string type { get; set; }
        public string logo { get; set; }
    
        public virtual ICollection<t_deliverable_item_mst> t_deliverable_item_mst { get; set; }
    }
I have create a kendo drop downlist as
@(Html.Kendo().DropDownList()
               .Name("dtype")
              .HtmlAttributes(new { style = "width: 200px" })
              
              .OptionLabel("Not working")
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      read.Action("GetTypes", "deliverable");
                  })
                  .ServerFiltering(true);
                  
              })
             .DataTextField("type")
             .DataValueField("pk_d_type_id")
             .SelectedIndex(0)
             .Template("<img src=\"" + Url.Content("~/images/dtype_logo/") + "${data.logo}\" alt=\"${data.type}\" />" +
                         "<dl>" +
                          "<dt>Type:</dt><dd>${data.type}</dd>" +
                         "</dl>")
            )

this is the method in my controller
 public JsonResult GetTypes()
        {
            deliverableEntities deliv_ent = new deliverableEntities();
            JsonResult types = new JsonResult();

            var type_list = deliv_ent.t_deliverable_type_mst.ToList();

            types= Json(type_list, JsonRequestBehavior.AllowGet);
           
            return types;
        }

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 31 May 2013, 10:08 AM
Hello Pritam,

Usually when there is an error (you need to check the console for errors) the spinning of the DropDownList never ends, could you share details about the error?

If there is no error we need a sample project to run or live URL to browse ,so we can see what the problem is.

Rest of the code look properly configured.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Pritam
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or