datagrid传参显示数据,怎么弄?
问题描述
小弟最近接触项目,,已知该业务编号由前一个页面带入,并不可修改,,想实现在当前页的datagrid中,显示这条业务编号的其他字段数据,而不是所有记录的所有全部数据,现在我用的是,先展示全部数据,然后再写了一个查询,以当前业务编号为条件,显示数据,但造成了加载页面时会先显示全部数据,然后再显示筛选后的数据,看网上应该可以直接datagrid传参加载自己想要的数据,请大神指点,下面是datagrid加载数据的url,
问题出现的环境背景及自己尝试过哪些方法
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
public ActionResult GetData(int page = 1, int rows = 10, string sort = "Id", string order = "asc", string filterRules = "")
{
var filters = JsonConvert.DeserializeObject<IEnumerable<filterRule>>(filterRules);
int totalCount = 0;
//int pagenum = offset / limit +1;
var customsinspection = _customsInspectionService.Query(new CustomsInspectionQuery().Withfilter(filters)).OrderBy(n=>n.OrderBy(sort,order)).SelectPage(page, rows, out totalCount);
var datarows = customsinspection.Select( n => new {
Id = n.Id,
Operation_ID = n.Operation_ID,
Flight_NO = n.Flight_NO,
Flight_Date_Want = n.Flight_Date_Want,
MBL = n.MBL,
Consign_Code_CK = n.Consign_Code_CK,
Book_Flat_Code = n.Book_Flat_Code,
Customs_Declaration = n.Customs_Declaration,
Num_BG = n.Num_BG,
Remarks_BG = n.Remarks_BG,
Customs_Broker_BG = n.Customs_Broker_BG,
Customs_Date_BG = n.Customs_Date_BG,
Pieces_TS = n.Pieces_TS,
Weight_TS = n.Weight_TS,
Volume_TS = n.Volume_TS,
Pieces_Fact = n.Pieces_Fact,
Weight_Fact = n.Weight_Fact,
Volume_Fact = n.Volume_Fact,
Pieces_BG = n.Pieces_BG,
Weight_BG = n.Weight_BG,
Volume_BG = n.Volume_BG,
IS_Checked_BG = n.IS_Checked_BG,
Check_QTY = n.Check_QTY,
Check_Date = n.Check_Date,
Fileupload = n.Fileupload,
Status = n.Status,
OperatingPoint = n.OperatingPoint}).ToList();
var pagelist = new { total = totalCount, rows = datarows };
return Json(pagelist, JsonRequestBehavior.AllowGet);
}
你期待的结果是什么?实际看到的错误信息又是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论