5

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.

1 Answer 1

6

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));
%>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.