Master page içinde kullanılacaksa

ilk olarak  EnableEventValidation="false"

Daha Sonra 

    public override void VerifyRenderingInServerForm(Control control)
    {
        if (control.ID != "GridView2")
            base.VerifyRenderingInServerForm(control);
    } 

 

    protected void lbtn_excele_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
        Response.Charset = "windows-1254";;
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.ContentType = "application/vnd.xls";

        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        dtg_liste.RenderControl(htmlWrite);
        Response.Write(stringWrite.ToString());
        Response.End();
    } 

 

 

Türkçe karakter sorunu yaşıyorsanız :

            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            dtg_DersiAlanlar.RenderControl(htw);

            Response.Clear();
            Response.ClearHeaders();
            Response.ClearContent();

            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1254");

            Response.Charset = "windows-1254";
            Response.Buffer = true;

            this.EnableViewState = false;
            Response.ContentType = "application/vnd.xls";

            Response.AddHeader("content-disposition", "attachment;filename=" + lbl_dersadi.ToolTip.Trim() + "_" + ddl_budersialanlarinbolumleri.SelectedValue.Trim() + "_SinavSonuclari.xls");

            string header = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1254\" />\n<style>\n</style>\n</head>\n<body>\n";

            Response.Write(header + sw);
            Response.End();