I have a view with two form one of them for declare rows per page. In post action I need my Url be the same and just add new parameter. at now I use like this:
[HttpPost]
public ActionResult Index(FormCollection collection) {
//Calculate Row Count
return RedirectToAction("Index", new { RC = RowCount });
}
with this implementation my all parameters lost and just RC = rowcountnumber
replaced.
How can I keep parameters and just add new RC
to it? what is fastest way to do it? is any performance issue here?
Unfortunately I can't test it right now, but I suspect this would work (though it does mutate the collection parameter). And it would perform well, as it's not copying over any items from the old collection; just adding one item to it.
check this, I am not sure is fastest or about performance issue, but worked:
Make the form
GET
notPOST
because the request is not changing anything on the server , soGET
verb is more appropriate , and also theGET
verb will pass all the form values as a query string parameters so you'll get the desired effectto do that in the
Html.BeginForm
the third parameter should beFormMethod.Get