I wasn't sure how to title this question. Currently in my Razor view I have the following
@Html.ActionLink("Rank -1", "ChangeRank", new
{
id = item.ID,
newRank = (item.UserRank + 1),
PosiFilter,
TeamFilter,
CurrentFilter,
userLeagueID
})
The last set of data, the PosiFilter, TeamFilter, CurrentFilter, etc is used all over my view in different @Html.ActionLinks. Is there a way to set all of these once at the start of my page,
@{
ViewBag.Title = "Index";
string PosiFilter = @ViewBag.posiFilter;
string TeamFilter = @ViewBag.teamFilter;
string CurrentFilter = @ViewBag.CurrentFilter;
int userLeagueID = @ViewBag.userLeagueID;
var GroupedRouteValues = PosiFilter, TeamFilter, CurrentFilter, userLeagueID
}
and then use them in an actionlink like so:
@Html.ActionLink("Rank -1", "ChangeRank", new
{
id = item.ID,
newRank = (item.UserRank + 1),
GroupedRouteValues
})
I tried playing around with @Url.Action but I couldn't figure out how to use it if I wanted to add extra route values to that particular link, yet include the routevalues fro earlier.