I have a view with two HtmlHelpers that produce links, something like this
<li><%:Html.ActionLink("Link A", "Index", "HomeController")%></li>
<li><%:Html.ActionLink("Link B", "Index", "HomeController"})%></li>
Now I want to add a request to link B when it points to the following URL http: // localhost: 55556 / HomeController /? Sort = LinkB
I want both links pointing to the same controller so that I can determine if the String request is present and then point to the corresponding link to another view, something like ...
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Index()
{
var linkChoice = Request.QueryString["Sort"];
if (linkChoice == "LinkB")
{
return View("ViewB");
}
else
{
return View("ViewA");
}
}
Thanks for the help.
source
share