protected void Page_Load(object sender, EventArgs e) { string strsql = "select m_login,m_name,m_mobile,m_mail,m_idcard," + " isnull(c.j_name,'') as m_jiao," + " isnull(b.b_name,'') as m_bum," + " isnull(d.d_name,'') as m_duty," + " m_birth " + " from tunnel_menber a" + " left join tunnel_bum b on a.m_bum=b.b_id" + " left join tunnel_jiaose c on a.m_jiao=c.j_id" + " left join Tunnel_duty d on a.m_duty=d.d_id"; DataSet das = Tunnel.Data.DbHelperSQL.Query(strsql); GridViewE.DataSource = das; GridViewE.DataBind(); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); this.GridViewE.RenderControl(hw); Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.Charset = ""; GridViewE.Page.EnableViewState = true; Response.AppendHeader("Content-Disposition", "attachment;filename=\"user.xls"); Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=UTF8\"><title> adsf</title></head><body>"); Response.Write("<table><tr><td> 帐号</td><td>姓名</td><td>电话</td><td>电子邮件</td><td>身份证号</td><td>角色</td><td>部门</td><td>职务</td><td>生日</td></tr>"); Response.Write(sw.ToString()); Response.Write("</table>"); Response.Write("</body></html>"); Response.End(); }
/// <summary> /// 页面数据绑定 /// </summary> public void PageBind() { string strsql = "select * from Tunnel_Message where datediff(dd,MesDate,GETDATE())=0 " + SearchWhere + " and DelDate is null order by MesDate Desc"; DataSet das = Tunnel.Data.DbHelperSQL.Query(strsql); GridViewE.DataSource = das; GridViewE.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); GridViewE.DataSource = tm.GetModelList("1=1"); GridViewE.DataBind(); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); this.GridViewE.RenderControl(hw); Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.Charset = ""; GridViewE.Page.EnableViewState = true; Response.AppendHeader("Content-Disposition", "attachment;filename=\"txl.xls"); Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=UTF8\"><title> adsf</title></head><body><table><tr><td> 帐号</td><td>姓名</td><td>电话</td><td>电子邮件</td></tr>"); Response.Write(sw.ToString()); Response.Write("</table></body></html>"); Response.End(); }
/// <summary> /// 页面数据绑定 /// </summary> public void PageBind() { PageBase pb = new PageBase(); pb.TblName = "Tunnel_menber"; pb.FldName = "m_id"; pb.ProcedureName = "pagination"; pb.PageSize = pageSize; if (cuttentPage == 0) { cuttentPage = pb.PageIndex; } pb.PageIndex = cuttentPage; pb.StrWhere = SearchWhere; int count = 0; List <Tunnel.Model.Tunnel_menber> modelList = new List <Tunnel.Model.Tunnel_menber>(); modelList = tbll.GetList(pb, ref count); //获取分页结果 pb.DoCount = 1; tbll.GetList(pb, ref count); //获取总条数 //数据绑定 GridViewE.DataSource = modelList; GridViewE.DataBind(); //数据分页 MTCPager1.PageSize = pageSize; MTCPager1.RecordCount = count; MTCPager1.PageIndex = cuttentPage; if (count <= pb.PageSize) { MTCPager1.Visible = false; } else { MTCPager1.Visible = true; } }
/// <summary> /// 页面数据绑定 /// </summary> public void PageBind() { // PageBase pb = new PageBase(); // pb.TblName = "Tunnel_menber"; // pb.FldName = "m_id"; // pb.ProcedureName = "pagination"; // pb.PageSize = pageSize; // if (cuttentPage == 0) // cuttentPage = pb.PageIndex; // pb.PageIndex = cuttentPage; // pb.StrWhere = SearchWhere; // int count = 0; // List<Tunnel.Model.Tunnel_menber> modelList = new List<Tunnel.Model.Tunnel_menber>(); // modelList = tbll.GetList(pb, ref count);//获取分页结果 // pb.DoCount = 1; // tbll.GetList(pb, ref count); //获取总条数 // //数据绑定 // GridViewE.DataSource = modelList; // GridViewE.DataBind(); // //数据分页 // MTCPager1.PageSize = pageSize; // MTCPager1.RecordCount = count; // MTCPager1.PageIndex = cuttentPage; // if (count <= pb.PageSize) // MTCPager1.Visible = false; // else // MTCPager1.Visible = true; string strsql = "select * from tunnel_menber where 1=1 " + SearchWhere + " order by m_id"; DataSet das = Tunnel.Data.DbHelperSQL.Query(strsql); GridViewE.DataSource = das; GridViewE.DataBind(); }
private void Bind() { HomeLinkManager manger = new HomeLinkManager(); string LoginName = Page.User.Identity.Name; GridViewE.DataSource = manger.GetAllhome(LoginName); GridViewE.DataBind(); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); this.GridViewE.RenderControl(hw); Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.Charset = ""; GridViewE.Page.EnableViewState = true; Response.AppendHeader("Content-Disposition", "attachment;filename=\"MyHome.xls"); Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=UTF8\"><title> adsf</title></head><body><table><tr><td> 名称</td><td>网站</td><td>网站类型</td><td>创建时间</td></tr>"); Response.Write(sw.ToString()); Response.Write("</table></body></html>"); Response.End(); }