How to get url parameter value of current route in view in ASP .NET MVC

Posted by Dima on Stack Overflow See other posts from Stack Overflow or by Dima
Published on 2012-09-04T15:20:53Z Indexed on 2012/09/04 15:38 UTC
Read the original article Hit count: 276

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc