ListView data isn't displaying

2 posts, 0 answers
  1. Brian
    Brian avatar
    3 posts
    Member since:
    Feb 2015

    Posted 02 Oct 2015 Link to this post

    Hello,

     I'm trying to create a kendo list view in razor c#. For some reason, when my view loads, the read.action gets hit, but it never enters my controller. I cant figure out why that is. Also, when I manually bind the data source using bindto(), i get the data back but it never gets rendered in the template. What am i doing wrong?

     

    Here is my listview wrapper :

       @(Html.Kendo().ListView<DAL_NEW.proc_GetDepartmentArticles>()
            .Name("DepartmentArticlesList")
         
          
          .ClientTemplateId("template")
          .TagName("div")
          
         

            .DataSource(datasource =>
            {
                    datasource.Model(model => model.Id(p => p.Article_ID));
                    datasource.Read(read => read.Action("GetDepartmentArticles", "Departments", new { departmentID = Model.CurrentSection.Section_ID.ToString() }));
                    datasource.PageSize(15);
            })
            .Pageable()
            
           )

     

    Here is the template (this isnt a real template, just for testing) :

     <script type="text/x-kendo-template" id="template">
    <div>
               <p> ${Title}</p> 
               <p> #=Title#</p>
              <p>  #:Title#</p>
                </div>
    </script>

     Here is the controller : 

    public ActionResultGetDepartmentArticles([DataSourceRequest]DataSourceRequest request,string departmentID)
            {
                List<proc_GetDepartmentArticles> articleList = db.Proc_GetDepartmentArticles(Pub.Pub_ID, Convert.ToInt32(departmentID)).ToList();


                return Json(articleList.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
            }

     

     ​

     

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 06 Oct 2015 Link to this post

    Hello Brian,

     

    Your setup looks correct, are you sure that you have a 'Title' field in your model? If this does not resolve the issue, please attach the sample here and we will be happy to investigate it!

     

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top