views:

374

answers:

2

I have a Gridview in my ASP.NET C# Page. It has a couple of columns and also one image column. I can export the entire columns to an Excel file, but the image column is blank. By the way, I use the full path.

Any Idea?

A: 

Response.Clear(); //this clears the Response of any headers or previous output Response.Buffer = true; //make sure that the entire output is rendered simultaneously

    Response.ContentType = "application/vnd.ms-excel";
    StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used

    HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
    GridView2.GridLines = GridLines.Both;
    GridView2.RenderControl(htmlTextWriter);
    Response.Write(stringWriter.ToString());
    Response.End();
Reena K
A: 

Here is complete details about all problems we face in this process: http://praveenbattula.blogspot.com/2010/09/gridview-and-export- to-excel.html