直接在网上搜索了转Excel的脚本,按照提示重写了VerifyRenderingInServerForm:
    public override void VerifyRenderingInServerForm(Control control)
    {
        //base.VerifyRenderingInServerForm(control);
    }
激活系统,提示System.Web.UI.Control 没有找到合适的方法来重写, 系统只有System.Web.UI.WebControl啊,没有System.Web.UI.Control,这个是为什么,要怎么解决啊,谢谢!

解决方案 »

  1.   

    不清不楚的,有没有using System.Web.UI.Control; 
      

  2.   

     EnableEventValidation="false"完整的:
    <%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="GridViewToExcelFile.aspx.cs" Inherits="_Default" %>
      

  3.   

    其实从office 2003开始,excel文件可以是一个XML文件,直接生成XML文件吧.省得麻烦.http://www.codeproject.com/KB/XML/ooxml_is_defective.aspx