Export To Excel Problem

G

Guest

When I execute the following code:

private void excelButton_Click(object sender, System.EventArgs e)
{
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;

System.IO.StringWriter tw = new
System.IO.StringWriter(System.Globalization.CultureInfo.CurrentCulture);
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
applicationPermissionGrid.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
}

Only the first three columns of the datagrid are exported to the excel
spreadsheet. Is there a reason the other 2 columns would no be exported as
well?

Thanks,

Dave
 
A

Alvin Bruney [Microsoft MVP]

couple things to check, the grid in question must be on an aspx page by
itself with no other controls. you also need to verify that there is more
than three rows at the time or render.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top