在页面中使用AjaxPager实现页面绑定,用$.ajax做参数传递时,如果返回的参数页数大于1,就会出现问题,提示AjaxPager有个key的值为null。但是换成$.post传递参数时,就不会出现类似问题,那位大侠帮忙看下为什么。
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<PagedList<ResouceManage.Models.Stat.ResourceUseForm>>" %><%@ Import Namespace="Webdiyer.WebControls.Mvc" %><div id="dvListRs"> <script type="text/javascript"> var pageindex_p74 =<%= ViewData["pageindexRs"]==null?"0":ViewData["pageindexRs"].ToString()%>; </script> <div style="clear: both"> </div> <div> <%=Html.AjaxPager(Model, new PagerOptions { ContainerTagName = "span", FirstPageText = "首页", LastPageText = "尾页", PrevPageText = "上一页", NextPageText = "下一页", PageIndexParameterName = "id", AlwaysShowFirstLastPageNumber = true, HorizontalAlign = "right", NumericPagerItemWrapperFormatString = "<span class=\"cpb\">{0}</span>", NavigationPagerItemWrapperFormatString = "<span class=\"ppb\">{0}</span>" }, new AjaxOptions() { UpdateTargetId = "dvList",OnBegin = "AjaxGetDataStart", OnComplete = "AjaxStop" }, new { Style = "float:right;width:40%;" })%> </div>
function SearchClick() { var date = new Date(); var project = $.trim($("#DDLProject").val()); var resourcetype = $.trim($("#DDLResourceType").val()); var businesstype = $.trim($("#DDLBusinessType").val()); var resourcestatus = $.trim($("#DDLResourceStatus").val()); var OpenstartDate = $.trim($("#OpenstartDate").val()); var OpenendDate = $.trim($("#OpenendDate").val()); var ClosestartDate = $.trim($("#ClosestartDate").val()); var CloseendDate = $.trim($("#CloseendDate").val()); $.ajax({ type: "get", url: "/Stat/QueryUseResource?" + "project=" + project + "&resourcetype=" + resourcetype + "&businesstype=" + businesstype + "&resourcestatus=" + resourcestatus + "&OpenstartDate=" + OpenstartDate + "&OpenendDate=" + OpenendDate + "&ClosestartDate" + ClosestartDate + "&CloseendDate" + CloseendDate + "&random=" + date.getTime().toString(), beforeSend: function (XMLHttpRequest) {// AjaxGetDataStart(); }, success: function (data, textStatus) { $("#dvListRs").html(data); }, complete: function (XMLHttpRequest, textStatus) {// AjaxStop(); }, error: function () { //请求出错处理// alert("111"); } });// AjaxGetDataStart();// $.post("/Stat/QueryUseResource",// {// project: $.trim($("#DDLProject").val()),// resourcetype: $.trim($("#DDLResourceType").val()),// businesstype: $.trim($("#DDLBusinessType").val()),// resourcestatus: $.trim($("#DDLResourceStatus").val()),// OpenstartDate: $.trim($("#OpenstartDate").val()),// OpenendDate: $.trim($("#OpenendDate").val()),// ClosestartDate: $.trim($("#ClosestartDate").val()),// CloseendDate: $.trim($("#CloseendDate").val())// },// function (returnText) {// $("#dvListRs").html(returnText);// AjaxStop();// }); }
1 回答
- 1 回答
- 0 关注
- 456 浏览
添加回答
举报
0/150
提交
取消