HtmlTextWriter

G

Guest

Hi,
I have an asp.net application which binds a dataview to a datagrid, which
then renders control to an HtmlTextWriter and then by doing a
"response.write" my datagrid is successfully displayed in excel format in the
browser. The only problem is that the "Mail as Attachment" button is
disabled. Is there a way with the style or any other way where I can specify
that this button should be enabled?
Below is some code from my asp.net application... thanks!
John
------------------------------------------------------------
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim sStyle As String

sStyle = "<style> " & _
"@page " & _
" {margin:.5in 0in .5in 0in; " & _
" mso-header-margin:.5in; " & _
" mso-footer-margin:.5in; " & _
" mso-page-orientation:landscape;} " & _
"</style>"

' Get the HTML for the control.
Datagrid1.RenderControl(hw)
' Write the HTML back to the browser.
Response.ContentType = "application/vnd.ms-excel"

Response.Write(sStyle)
Response.Write(tw.ToString())
' End the response.
Response.End()
 

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

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top