ASP.NET Razor: Send variable as parameter
<p>My view contains the following table definition:</p>

<pre><code>&lt;table&gt;
    &lt;thead&gt;
    &lt;th&gt;Title&lt;/th&gt;
    &lt;th&gt;Artist&lt;/th&gt;
    &lt;th&gt;Genre&lt;/th&gt;
    &lt;th&gt;Price&lt;/th&gt;
    &lt;/thead&gt;
    @foreach (var album in Model)
    {
        &lt;tr&gt;
            &lt;td&gt;@album.Title&lt;/td&gt;
            &lt;td&gt;
                @{
                    foreach (var artist in ViewBag.Artists)
                    {
                        if (artist.ArtistID == album.ArtistID)
                        { @artist.Name }
                    }
                }
            &lt;/td&gt;

            &lt;td&gt;
                @{
                    foreach (var genre in ViewBag.Genres)
                    {
                        if (genre.GenreID == album.GenreID)
                        { @genre.Name }

                    }
                }
            &lt;/td&gt;

            &lt;td&gt;@album.Price&lt;/td&gt;
            &lt;td&gt;
                &lt;a asp-action="Details" asp-controller="Albums"&gt;Details &lt;/a&gt;
                &lt;a asp-action="Edit" asp-controller="Albums"&gt;Edit &lt;/a&gt;
                &lt;a asp-action="Delete" asp-controller="Albums"&gt;Delete&lt;/a&gt;
            &lt;/td&gt;
        &lt;/tr&gt;

    }
&lt;/table&gt;
</code></pre>

<p>The <code>Details</code>, <code>Edit</code>, and <code>Delete</code> options in the final column need to be keyed to the <code>AlbumID</code> property of the <code>album</code> variable, in order to ensure that the redirect operates on the proper album. I had thought the parameter for this might be <code>asp-parameter</code>, much like the action is set by <code>asp-action</code>, but this does not appear to exist.</p>

<p>What is the proper method to pass a variable as a URL parameter (for instance, <code>/Albums/Details/var</code>), and what name is used to retrieve this on the other side?</p>

<p>Shyju's answer deals with passing the parameter; my attempts at retrieving the parameter thus far have been as follows:</p>

<p><code>&lt;%=Url.RequestContext.RouteData.Values["id"]%&gt;</code> - Fails to load, invalid character <code>&lt;</code>.</p>

<p><code>ViewContext.RouteData.Values["id"]</code> - Fails to load, cannot compare <code>int</code> and <code>object</code> using <code>==</code>.</p>

<p><code>RouteData.Values["id"]</code> - Compilation error, name does not exist in current context.</p>