How do partialviews work in asp.net MVC when passing parameters back?
- by Rob Ellis
I have a page with a partialview on it which is a list of items. I have a button on it which shows the next 5 items.
This is done via ajax:-
using (Ajax.BeginForm("ShowUpdates", new AjaxOptions() { UpdateTargetId = "statusUpdateContainer", InsertionMode = InsertionMode.InsertAfter }))
{
<input type="submit" class="formbutton" value="Show More" style="width:100%;"/>
}
My partial view controller:
[HttpPost]
public ActionResult ShowUpdates(string page, string pagesize)
{
//get data code hidden here
return PartialView("_statusUpdates");
}
My question is that I need the 'page' variable to increment each time someone presses the form button which is contained within the partialview.
How do I keep track of that variable?