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

ListView data isn't displaying

1 Answer 26 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 02 Oct 2015, 02:20 PM

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);
        }

 

 ‚Äč

 

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 06 Oct 2015, 03:04 PM

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!
 
Tags
ListView
Asked by
Brian
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or