ListView - call partial view with parameter

1 Answer 21 Views
ListView
AP
Top achievements
Rank 1
Iron
Veteran
AP asked on 11 May 2021, 08:34 AM

I have a ListView control, and I need to call a partial view to render part of the template contents.  This can't be passed via the ListView data source, as its a more expensive query, and should only be called for the records shown on the current page.

I have tried the code below, but it only gets called once, passing in an empty parameter.

<script type="text/x-kendo-tmpl" id="template">
    <div>
    <p>#=Name#  <span>@Html.Action("ReportTags", "Search", new { reportKey = "#=ReportKey#" })</span></p>
    </div>
</script>

I need the functionality offered by the LoadContentFrom method in the tabstrip, but as part of the template.

I tried looking at the databound event, but this only gets called once per page, not per record.

Thanks

NB: I have to say the change to the forums makes it harder to browse for solutions by control, which is something I found useful.

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 14 May 2021, 07:03 AM

Andrew,

Unlike the TabStrip, the ListView is not a navigation component, so the capabilities for loading partial views of the TabStrip are not available in the ListView. Calling a partial view for each template is no supported.

With regard to browsing for solutions by component in the forums, you can use tags. On the right hand side of the forums page there is a searchbox, that you can use to find and then select a tag (e.g., "ListView") or several tags. You can then use the main searchbox to browse for a topic.

Regards,
Ivan Danchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ListView
Asked by
AP
Top achievements
Rank 1
Iron
Veteran
Answers by
Ivan Danchev
Telerik team
Share this question
or