private void ExportDataGrid(string FileType, string FileName) //植DataGrid絳堤 
    {
        Response.Charset = "GB2312";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
        Response.ContentType = FileType;
        this.EnableViewState = false;
        StringWriter tw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(tw);
     this.GridView1.RenderControl(hw); 
        Response.Write(tw.ToString());
        Response.End();
    }
        
    protected void Button1_Click(object sender, EventArgs e)
    {
        ExportDataGrid("application/ms-excel", "硌杅蹈桶.xls"); 
    }说是这个错? 
  不是类型“GridView”的控件“GridView1”必须放在具有 runat=server 的窗体标记内。