Export To Excel
<p>I have a grid view. Am trying to export in the excel.
The code is as follows : </p>

<pre><code>public override void VerifyRenderingInServerForm(Control gvReport1)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string attachment = "attachment; filename=Report.xls";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
        Response.ContentType = "application/vnd.ms-excel";
        Response.Charset = "";
        this.EnableViewState = false;
        StringWriter stw = new StringWriter();
        HtmlTextWriter htextw = new HtmlTextWriter(stw);
        gvReport1.RenderControl(htextw);
        Response.Write(stw.ToString());
        Response.End();
    }
</code></pre>

<p>Now the problem is that an excel file is opening but data is not getting displayed. I guess the data is not getting read, and the more wierd thing is that I have two web pages. In the first webpage the export to excel is working properly, but on the second page it does not work.</p>
