为了账号安全,请及时绑定邮箱和手机立即绑定

用过jquery jqgrid的帮忙看下这个问题。。。。

用过jquery jqgrid的帮忙看下这个问题。。。。

万千封印 2018-12-06 17:54:10
<script type="text/javascript" charset="gb2132"> $(document).ready(function () { jQuery("#list").jqGrid({ url: 'ashx/BaseBranchManager.ashx?type=GetBaseBranch', mtype: 'POST', datatype: "json", height: 'auto', width: 500, colNames: ['编号', '名称'], colModel: [ { name: 'BranchID', index: 'BranchID', width: '50' }, { name: 'BranchDesc', index: 'BranchDesc' } ], viewrecords: true, rowNum: 10, rowList: [10, 20, 30], sortname: 'CommentID', jsonReader: { root: "rows", page: "pageindex", total: "pagecount", records: "total", repeatitems: false, id: "0" }, loadonce: true, sortname: 'id', viewrecords: true, pager: "#pager", caption: "客户列表", sortorder: "desc", hidegrid: false, onSelectRow: function (ids) { jQuery("#order").setGridParam({ url: "ashx/Handler.ashx?BranchId=" + ids, page: 1 }).trigger("reloadGrid"); alert(ids); } }); jQuery("#list").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false }); jQuery("#order").jqGrid({ url: '', mtype: 'POST', datatype: "json", height: 'auto', width: 500, colNames: ['编号'], colModel: [ { name: 'BranchID', index: 'BranchID', width: '50' } ], viewrecords: true, rowNum: 10, rowList: [10, 20, 30], sortname: 'CommentID', jsonReader: { root: "rows", page: "pageindex", total: "pagecount", records: "total", repeatitems: false, id: "0" }, loadonce: true, sortname: 'id', viewrecords: true, pager: "#orderppage", caption: "客户列表", sortorder: "desc", hidegrid: false }); jQuery("#order").jqGrid('navGrid', '#orderppage', { edit: false, add: false, del: false }); }); </script> 上面是我一个主从表的代码,也就是点击一个列后,另一个表根据ID绑定数据!但是出现这样的情况,就是说,第一次点击的时候,就会进入BaseBranchManager.ashx文件中,但是第二次再点击就不可以!BaseBranchManager.ashx代码如下: public void ProcessRequest (HttpContext context) { context.Response.ContentType = "application/json"; string resultJson = ""; if (context.Request["type"] == "GetBaseBranch") { resultJson = GetBaseBranch(); } if (context.Request["type"] == "GetOrderCar") { resultJson = SelectOrderdtByBanchId(context.Request["BranchId"].ToString()); } context.Response.Write(resultJson); } private static string GetBaseBranch() { WcfService.ProductsServiceClient pr = new WcfService.ProductsServiceClient(); DataTable dt = pr.GetBaseBranch(); // 每页显示记录数 int pageSize = 10; // 记录总数 int rowCount = dt.Rows.Count; // 总页数 int pageCount = rowCount % pageSize == 0 ? rowCount / pageSize : rowCount / pageSize + 1; var resultObj = new DataResult { // 总页数 PageCount = pageCount, // 当前页 PageIndex = 1, // 总记录数 Total = rowCount, // 数据 Data = dt }; string resultJson = JsonHelper.Serialize(resultObj); return resultJson; } 试过用其他ASP页面来实现,但是如果我用 Response.End()的话,就第二次不进来执行方法,不用 Response.End()的话,又不显示数据!请问这是什么回事呢!
查看完整描述

1 回答

?
30秒到达战场

TA贡献1828条经验 获得超6个赞

去除
 loadonce: true,问题解决!
查看完整回答
反对 回复 2018-12-24
  • 1 回答
  • 1 关注
  • 585 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号