append a parameter to querystring of existing url asp.net mvc

asp.net-mvc, c#

Solution

You're going to need to build a custom `RouteValueDictionary` variable to pass to Html.ActionLink. Try something like this:

<% 
     var rvd = new RouteValueDictionary(ViewContext.RouteData.Values);
     foreach (string key in Request.QueryString.Keys )
     {
         rvd[key]=Request.QueryString[key];
     } 
     rvd["MyParam"] = "WhateverValue";
     Response.Write(Html.ActionLink("Link Text", "Action", rvd));
%>

Problem

Im using asp.net mvc. c# How can i get the existing url (may have a bunch of querystring parameters on it) and then just append another parameter to the quesrystring. and make this a clickable hyperlink.

Original source