塔塔塔吖 2016年12月19日
datagrid问题,跪求大神帮忙解决
easyui datagrid后台显示数据之前先判断怎么写,比如用户类型是管理员的就不要在页面显示?用户类型有:1、附属用户;2、注册用户;3、管理员,在用户管理模块只显示附属用户和注册用户。
public ActionResult Query(int page = 1, int rows = 30, string sort = "U_ID", string order = "desc")
{

Expression<Func<TB_User, dynamic>> select = n => new
{
U_ID = n.U_ID,
U_NAME = n.U_NAME,
U_PWD = n.U_PWD,
U_TYPE = n.U_TYPE,
U_LastDate = n.U_LastDate,
U_SHOW_Name = n.U_SHOW_Name,
U_Mail = n.U_Mail,
U_Phone = n.U_Phone,
U_Fixed = n.U_Fixed,
U_Line = n.U_Line,
U_Line_Pwd = n.U_Line_Pwd,
};
bool ascending = true;
if (!string.IsNullOrEmpty(order) && order == "desc")
{
ascending = false;
}
Expression<Func<TB_User, bool>> where = (n => true);
if (!string.IsNullOrEmpty(Request["U_ID"]))
{
try
{
int ss = Convert.ToInt32(Request["U_ID"]);
where = where.And(n => n.U_ID == ss);
}
catch
{

}
}
if (!string.IsNullOrEmpty(Request["U_NAME"]))
{
string sName = Request["U_NAME"];
where = where.And(n => n.U_NAME.Contains(sName));
where = where.Or(n => n.U_SHOW_Name.Contains(sName));
}
int totalRecord = 0;
var data = userDal.getPageDate(select, where, sort, ascending, page, rows, out totalRecord);
Hashtable hb = new Hashtable();
hb["total"] = totalRecord;
hb["rows"] = data;
return Json(hb, "text/html", JsonRequestBehavior.AllowGet);
}
...全文
65 点赞 收藏 2
写回复
2 条回复

还没有回复,快来抢沙发~

发动态
发帖子
JavaScript
创建于2007-09-28

5.1w+

社区成员

22.3w+

社区内容

Web 开发 JavaScript
社区公告
暂无公告