I have a rad pivot grid and I am trying to export the grid to pdf and csv. I am able to export it to excel. Is there a work around to get it exported to other formats. Would appreciate any suggestions you might have.
I tried this for .csv but I am unable to get any data.
protected void btnExportCSV_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=GridViewExport.csv");
Response.Charset = "";
Response.ContentType = "application/text";
RadPivotGrid1.AllowPaging = false;
RadPivotGrid1.DataBind();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < RadPivotGrid1.Fields.Count; i++)
{
//add separator
sb.Append(RadPivotGrid1.Fields[i].ToString() + ',');
}
//append new line
sb.Append("\r\n");
lblTest.Text = sb.ToString();
Response.Output.Write(sb.ToString());
Response.Flush();
Response.End();
}
I think I am not doing this right? What is the best way to loop through the cells in a pivot grid and get data.
for (int i = 0; i < RadPivotGrid1.Fields.Count; i++)
{
//add separator
sb.Append(RadPivotGrid1.Fields[i].ToString() + ',');
}
Thanks
I tried this for .csv but I am unable to get any data.
protected void btnExportCSV_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=GridViewExport.csv");
Response.Charset = "";
Response.ContentType = "application/text";
RadPivotGrid1.AllowPaging = false;
RadPivotGrid1.DataBind();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < RadPivotGrid1.Fields.Count; i++)
{
//add separator
sb.Append(RadPivotGrid1.Fields[i].ToString() + ',');
}
//append new line
sb.Append("\r\n");
lblTest.Text = sb.ToString();
Response.Output.Write(sb.ToString());
Response.Flush();
Response.End();
}
I think I am not doing this right? What is the best way to loop through the cells in a pivot grid and get data.
for (int i = 0; i < RadPivotGrid1.Fields.Count; i++)
{
//add separator
sb.Append(RadPivotGrid1.Fields[i].ToString() + ',');
}
Thanks