62,272
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
if (Session["yggh"] == null)
{
Response.Redirect("Login.aspx");
}
if (!IsPostBack)
{
BindCkd();
PageManage();
}
lblmessage.Text = "";
}
protected void Excel(string FileType, string FileName)
{
this.GVrkdmx.Columns[0].Visible = false;
this.GVrkdmx.Columns[3].Visible = false;
this.GVrkdmx.Columns[4].Visible = false;
Response.Clear();
System.Web.HttpContext curContext = System.Web.HttpContext.Current;
Response.AddHeader("content-disposition", "attachment;filename=CPCKD" + System.DateTime.Now.Date.Day + ".xls");
Response.Charset = "utf-8";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GVrkdmx.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());//向客户端写数据
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
}
protected void btnexcel_Click(object sender, EventArgs e)
{
Excel("application/ms-excel", "TCRM.xls");
}