473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HtmlTextWriter

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()

Sep 13 '06 #1
0 1615

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Blaz Ziherl | last post by:
Hi, I am developing an application in VisualBasic .NET and got the following error: "An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll ...
2
by: Gustaf Liljegren | last post by:
I need to export an HTML file, conforming to HTML 4.01 Strict in UTF-8. I have written code for this in XmlTextWriter. Unfortunately, there seem to be no way to remove the XML declaration. The...
1
by: Rudy Ko | last post by:
Hi, All: I'm populating database records into a panel controls and want to render that panel into a HtmlTextWriter which will creating a word document. Do you know how to insert a page break...
1
by: Tammy | last post by:
I am fairly new to asp and web development. I'm having a tough time with the htmltextwriter. I keep receiving an error that basically says 'object reference not set to instance of object. It sure...
3
by: Lee Chapman | last post by:
Hi, I want my ASP.NET web application to use a custom HtmlTextWriter. i.e. I want the object that the Framework passes to System.Web.UI.Control.Render() to be my own object, MyHtmlTextWriter,...
2
by: larryvan | last post by:
I have been beating my head against a wall for two days now. I need to output a hyperlink using htmltextwriter.write that looks like this: <a...
4
by: James Page | last post by:
I can't seem to get HtmlTextWriter / renderControl to work for sending a control (html) in an e-mail messsage (VB.NET). Keeps telling me that control needs to be in a form tag with runat server...
2
by: rodchar | last post by:
hey all, can someone please show me how to write this to a stringbuilder using the htmltextwriter: <ul><li>test</li></ul> thanks, rodchar
0
by: dihola | last post by:
Hi all, A component I have renders itself (essentially an HTML table) using an HtmlTextWriter object to create some HTML code. This component is part of an aspx page. I need the component to also...
3
by: =?Utf-8?B?cndvb2RydWY=?= | last post by:
Hello All, I am using an HtmlTextWriter to writer out some html. Prior to sending the content to the text writer, HttpUtility.HtmlEncode the string. However, doing so results in a string where...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.