来源:百度文库 编辑:偶看新闻 时间:2024/05/03 09:00:51
截图:
页面:
view plaincopy to clipboardprint?-
-
-
引用的JS:
view plaincopy to clipboardprint?- "stylesheet" type="text/css" href="http://www.cnblogs.com/script/themes/default/easyui.css" />
- "stylesheet" type="text/css" href="http://www.cnblogs.com/script/themes/icon.css" />
-
-
-
JS:
view plaincopy to clipboardprint?-
这里面要注意的是,"操作"的跨行,一定要带上field:'opt',当然,field可以是任何值,这个值不用从数据库中绑定,随便取.如果没有field的话,会弹出 "rowspan为空或不是对象"的错误
获取数据和分页ashx:
view plaincopy to clipboardprint?- using System;
- using System.Web;
- using System.Data;
- using System.Text;
-
- public class studentHandler : IHttpHandler {
-
- public void ProcessRequest (HttpContext context) {
- context.Response.ContentType = "text/plain";
- DataSet ds = new DataSet();
- //点击datagrid的分页按钮,自动向后台发送2个参数,rows和page,代表每页记录数和页索引
- int row = int.Parse(context.Request["rows"].ToString());
- int page = int.Parse(context.Request["page"].ToString());
- ds = GetContent(row, page);
- string text =json.Dataset2Json(ds);
- context.Response.Write(text);
- }
-
- private DataSet GetContent(int pagesize,int pageindex)
- {
- Graduate.BLL.Student bll = new Graduate.BLL.Student();
- return bll.GetList(pagesize, pageindex);
- }
- public bool IsReusable {
- get {
- return false;
- }
- }
-
- }
删除ashx
view plaincopy to clipboardprint?- using System;
- using System.Web;
- using System.Web.SessionState;
-
- public class delHandler : IHttpHandler,IRequiresSessionState {
-
- public void ProcessRequest (HttpContext context) {
- context.Response.ContentType = "text/plain";
- string id = context.Request["id"].ToString();
- string type = context.Request["type"].ToString();
- switch (type)
- {
- case "stu":
- Graduate.BLL.Student stubll = new Graduate.BLL.Student();
- stubll.Delete(id, HttpContext.Current.Session["username"].ToString(), HttpContext.Current.Session["usertype"].ToString());
- break;
- default:
- break;
- }
- }
-
- public bool IsReusable {
- get {
- return false;
- }
- }
-
- }
IRequiresSessionState 是因为用到了服务器端的session,没有用到的话可以去掉
加载相关js和css,因为easyui依赖jquery,所有加载easyui前要先加载jquery,否则为提示找不到datagrid
Html代码