How to get url parameter value of current route in view in ASP .NET MVC
- by Dima
For example I am on page http://localhost:1338/category/category1?view=list&min-price=0&max-price=100
And in my view I want to render some form
@using(Html.BeginForm("Action", "Controller", new RouteValueDictionary { { /*this is poblem place*/ } }, FormMethod.Get))
{
<!--Render some controls-->
<input type="submit" value="OK" />
}
What I want is to get view parameter value from current page link to use it for constructing form get request. I tried @using(Html.BeginForm("Action", "Controller", new RouteValueDictionary { { "view", ViewContext.RouteData.Values["view"] } }, FormMethod.Get)) but it doesn't help.