Reputation: 8646
I have taken list in viewbag in controller as follows:
List<TEAMS_PP.Entity.account> list = new TeacherEval().AllTechersList();
ViewBag.allteacherlist = list;
I have made sure that list do come in ViewBag.allteacherlist.
I wanted to show it in listview on view page(cshtml)
I made following code:
@(Html.Kendo().ListView<ViewBag.allteacherlist>()
.Name("ListView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource => dataSource
.Read(read => read.Action("Products_Read", "Home")) // Specify the action method and controller name
)
.Pageable()
)
But i am not able to access viewbag.allteacherlist over here.
I just want to display list comming in viewbag on the page.
What can i do???
Please help me.
Upvotes: 1
Views: 593
Reputation: 1742
This is the correct syntax
@(Html.Kendo().ListView<TEAMS_PP.Entity.account>(ViewBag.allteacherlist as IEnumerable<TEAMS_PP.Entity.account>)
.Name("ListView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource => dataSource
.Read(read => read.Action("Products_Read", "Home")) // Specify the action method and controller name
)
.Pageable()
)
Upvotes: 3
Reputation: 4100
Try this :
@(Html.Kendo().ListView<(List<TEAMS_PP.Entity.account>)ViewBag.allteacherlist>()
.Name("ListView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource => dataSource
.Read(read => read.Action("Products_Read", "Home")) // Specify the action method and controller name
)
.Pageable()
)
Upvotes: 1