Hi guys i have a listview that has been populated with data from a database and i now want on button click to export the listview data to a particular folder on the c drive..without the pop up i am getting . below is the code i am using to do the export.
public int Export(ListView lsvt) {
try
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment;filename=C:\\test.xls");
Response.ContentType = "application/excel";
Response.Buffer = true;
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
ListView1.RenderControl(htmlTextWriter);
string content = stringWriter.ToString();
Response.Write(content);
Response.End();
return 0;
}
catch (Exception ex) {
return 1;
}
}