I am binding a ListView to a collection of strings. How can I access that data in the template definition? Model.SearchResults is a type of IEnumberable<string>
@(Html.Kendo().ListView(Model.SearchResults)
.Name("listClients")
.TagName("div")
.ClientTemplateId("clientsTemplate")
.Pageable(pageable => pageable
.PreviousNext(true)
.Info(true)
.PageSizes(true))
.HtmlAttributes(new{style="min-height:300px"})
.DataSource(dataSource => dataSource
.PageSize(1)))
<
script
type
=
"text/x-kendo-tmpl"
id
=
"clientsTemplate"
>
@Html.Action("LoadProfileView", new { clientId = **HOW DO I GET THE VALUE HERE**})
</
script
>
5 Answers, 1 is accepted
0
Hi Cristina,
Please refer to this help article: http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/listview/overview#setup
Regards,
Venelin
Telerik
Please refer to this help article: http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/listview/overview#setup
Regards,
Venelin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0

Cristina
Top achievements
Rank 1
answered on 19 May 2016, 02:56 PM
I apologize if I am confused, but I don't see what that article has to do with my question. Clearly I know how to setup the ListView, as you can see in the code that is part of the initial question. I don't see anything in the setup article that address the template context or anything else having to do with my issue. Can you please explain what solution you are directing me to?
0
Hi Cristina,
Sorry, for some reason I thought the problem is in the treelist binding. To answer the question "How can I access that data in the template definition?" this can be done by using the reserved variable "data":
Attached is a simple example.
Howerver, I am not sure what are you trying to achieve with the @Html.Action... code, could you please explain further?
Regards,
Venelin
Telerik
Sorry, for some reason I thought the problem is in the treelist binding. To answer the question "How can I access that data in the template definition?" this can be done by using the reserved variable "data":
<
script
type
=
"text/x-kendo-tmpl"
id
=
"clientsTemplate"
>
#:data#
</
script
>
Attached is a simple example.
Howerver, I am not sure what are you trying to achieve with the @Html.Action... code, could you please explain further?
Regards,
Venelin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0

Cristina
Top achievements
Rank 1
answered on 20 May 2016, 01:15 PM
I'm trying to load a partial view with a different model than the one for the main view. So I want to pass a client ID as a parameter to the controller action to build the ViewModel then return the partial view. I had actually tried using "#= data #" but it just sent that as a literal string, not the value of the current list item.
0
Hi Cristina,
Try using the syntax below for passing the actual data:
Regards,
Maria Ilieva
Telerik
Try using the syntax below for passing the actual data:
#:data#
Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items