How do partialviews work in asp.net MVC when passing parameters back?
Posted
by
Rob Ellis
on Stack Overflow
See other posts from Stack Overflow
or by Rob Ellis
Published on 2011-03-11T08:06:37Z
Indexed on
2011/03/11
8:10 UTC
Read the original article
Hit count: 248
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?
© Stack Overflow or respective owner