zoukankan      html  css  js  c++  java
  • girdView数据导出Excel

    /// <summary>
        /// 导出分页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExport_Click(object sender, EventArgs e)
        {
            Response.Clear();
            Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
            Response.Charset = "gb2312";
            Response.ContentType = "application/vnd.xls";
            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
    
            gvScenic.AllowPaging = false;
            bindData();
            gvScenic.RenderControl(htmlWrite);
    
            Response.Write(stringWrite.ToString());
            Response.End();
            gvScenic.AllowPaging = true;
            bindData();
        }

    加入form=ruanserver验证,否则报错

    public override void VerifyRenderingInServerForm(Control control)
        {
    
        }

    前台页面加入

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="testtest" EnableEventValidation = "false" %>
    EnableEventValidation = "false"
  • 相关阅读:
    重拾数学--初中--有理数
    Python中的运算符
    PyQt5实现虚拟摇杆
    Python无重复字符的最长子串
    Python两数相加
    Python两数之和
    DBMS,B树和B+树
    浮点数表示
    Lamada表达式
    Java编程思想P159页的错误
  • 原文地址:https://www.cnblogs.com/ilooking/p/4768896.html
Copyright © 2011-2022 走看看