Hello,

Any one can help me I want that "Data grid data export in Excelsheet when button is clicked" in C#

Search DaniWeb, Google, example Click Here

This will export a GridView to Excel

   protected void btnExport_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
        Response.Charset = string.Empty;

        // If you want the option to open the Excel file without saving then
        // comment out the line below
        // Response.Cache.SetCacheability(HttpCacheability.NoCache);

        Response.ContentType = "application/vnd.xls";
        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        gridView.RenderControl(htmlWrite);

        Response.Write(stringWrite.ToString());
        Response.End();
    }

Great. And exactly what is Response?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.