grid表格查询问题
是这样,公司在网上找人做了一个程序,现在功能里少一个公员信息表的查询功能,让那人加一直推托没时间不愿弄。无奈自己又不会,只能求助这里了。程序用的是C#+jQuery。看了网上的DEMO自己写了些,但是总的内容表能搜索出来,但是条件搜索结果不会弄了,以下是前台代码:关键字:<input class="mini-textbox" id="keywords" />
<input class="mini-button" type="button" onClick="query()" iconCls="icon-search" text="查询" />
</td>
</tr>
</table>
</div>
<div class="mini-fit">
<div id="filegrid" multiselect="true" pagesize="20" class="mini-datagrid" style="height: 100%; width: 100%;" url="/handler/member/memtable.ashx" idfield="id" multiselect="true" sizeList="[20,30,50,100]" pageSize="20" >
<div property="columns">
<div type="checkcolumn" width="20"></div>
<div type="indexcolumn" headerAlign="center" ><b>编号</b></div>
<div field="UserName" width="100" headerCls="red" headerAlign="center" allowsort="true"><b>用户名</b></div>
<div field="RealName" width="80" headerAlign="center" allowsort="true"><b>姓名</b></div>
<div field="Phone" width="100" headerAlign="center" allowsort="true"><b>手机号</b></div>
<div field="City" width="140" headerAlign="center" allowsort="true"><b>地区</b></div>
<div field="Email" width="160" headerAlign="center" allowsort="true"><b>邮箱</b></div>
<div field="RegDate" width="130" headerAlign="center" allowsort="true"><b>注册时间</b></div>
<div field="Ok" width="60" headerAlign="center" allowsort="true"><b>审核状态</b></div>
<div field="Group" width="50" headerAlign="center" allowsort="true"><b>管理</b></div>
</div>
</div>
</div>
以下是JS代码:
var filegrid;
var keywords;
$(function () {
mini.parse();
filegrid = mini.get("filegrid");
filegrid.load();
});
function query() {
var key = document.getElementById("keywords").value;
grid.load({ keywords: keywords });
}
$("#keywords").bind("keydown", function (e) {
if (e.keyCode == 13) {
query();
}
});
以下是服务器查询代码ashx文件:
public class memtable : IHttpHandler,IRequiresSessionState
{
[WebMethod(EnableSession=true)]
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.ContentType = "utf-8";
Membership.CheckAdmin();
//分页
int pageindex = Convert.ToInt32(context.Request["pageIndex"]);
int pagesize = Convert.ToInt32(context.Request["pageSize"]);
//字段排序
String sortField = context.Request["sortField"];
String sortOrder = context.Request["sortOrder"];
//查询条件
String keywords = context.Request["keywords"];
using (DbContext DbContext = new DbContext())
{
int recordCount = (from c in DbContext.Member where c.RealName == keywords || c.UserName == keywords || string.IsNullOrEmpty(keywords) select c).Count();
var list = (from c in DbContext.Member where c.RealName == keywords || c.UserName == keywords || string.IsNullOrEmpty(keywords) select c).Skip(pageindex * pagesize).Take(pagesize).ToList();
context.Response.Write("{total:" + recordCount + ",data:" + JsonHelper.SerializeObject(list) + "}");
}
哪位帮帮我,拜托了
--------------------编程问答-------------------- 查询条件组合一下 --------------------编程问答-------------------- 能不能简单帮写一下,实在不会弄了。
补充:.NET技术 , ASP.NET