Reputation: 197
I have this existing application now user wants me to add a new page.But URL should be same. i.e.there is already a view name Index.
http://www.localhost/Index?mdn=&Mdn wdate=&Wdate
Now user wants me to add a new view named Count but they wants url should be like this.(except one query string.)
http://www.localhost/Index?mdn=&Mdn count=&Count
I am new in asp.net MVC. Please help thanks.
Upvotes: 0
Views: 92
Reputation: 18977
There is several ways to achieve that. One way is using RedirectToAction()
:
public ActionResult Index(string count)
{
if (count == "Count")
return RedirectToAction("newActionMethod");
// ... other codes ...
return View();
}
Upvotes: 1
Reputation: 1090
In your controller action, you can choose which view to render:
public ActionResult Index(...)
{
if (...)
return View("Count");
return View(); // returns the default view (in this case "Index")
}
Upvotes: 1