public static RouteValueDictionary AppendPageIndexToQuery(int pageIndex)
{
RouteValueDictionary dict = new RouteValueDictionary();
foreach (string key in HttpContext.Current.Request.QueryString.AllKeys)
{
if (string.Compare(key, "page", true) == 0)
continue;
dict.Add(key, HttpContext.Current.Request.QueryString[key]);
}
dict.Add("page", pageIndex);
return dict;
}
页面调用
<span><a href="@Url.Action("MemberForActivityList", "MemberCommunication", ViewHelper.AppendPageIndexToQuery(1))">
首页</a> </span>