Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Render just partial view on list item click

$
0
0

Hello!

I have more partial views on the page. One contains the list of music(stored on Azure Storage) and an other the media player. I want to load just the media player partial view by clicking on an item from the list. I also have to pass data(in my case a link) to the controller. I've read about AJAX, but I didn't find an example when you select a list item and pass data too...Here is my list:

<ul style="list-style:none">
    @foreach (var item in Model)
    {<li><p><a asp-controller="Music" asp-action="Play" asp-route-uri="@item.DownloadUri">@item.TitleOnView</a></p></li>
    }</ul>

and the controller:

[HttpGet]
public IActionResult Play(string uri)
{
    ViewData["uri"] = uri;
    return PartialView("_MediaPlayerPartial");
}

Thanks!

 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>