Search code examples
asp.net.netasp.net-mvcasp.net-mvc-3razor

Pass data from view to controller on Get Call in mvc3


I have dropdown which is used for displaying pagesize in view. example as

@Html.DropDownListFor(m => m.PageSize,
new List<SelectListItem>() { new SelectListItem() { Text = "10" }, 
new SelectListItem() { Text = "20" },
new SelectListItem() { Text = "50" },
new SelectListItem() { Text = "100" }
})

I have to get the selected item value inside controller action.

my action will accept only get call. I just don't want to pass as query string. so how to achieve this?


Solution

  • If you want to pass it using a GET I'm afraid your only option is a query string.

    To take a quote from the w3.org spec:

    "The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI."