Hi I have a gridview which is bound to a datatable called datasource. The datatable is populated with data from the database which is then displayed in gridview. However I would like to add a title to the gridview, I tried this with gridiview.caption and it works fine. However users are able to download the gridview as a csv, the code for this is
protected void downRep_Click(object sender, EventArgs e)
{
String name = Request.QueryString["name"];
MemoryStream ms = new MemoryStream();
core.Data.CSVDataWriter c = new CSVDataWriter();
c.Export(ms, datasource);
Response.Clear();
Response.ContentType = "text/csv";
Response.AddHeader("Content-Disposition", "attachment; filename=" + name + ".csv");
Response.BinaryWrite(ms.ToArray());
Response.Flush();
Response.Close();
Response.End();
}
as you can see it is exporting the data stored in datasource to the csv so it is unable to see the caption that is included in the gridview. Is there a way I can add the title to datasource?