Hey Ray,
Here's something adapted from ASP.NET 2.0 Cookbook from O'Reilly
(
http://www.oreilly.com/catalog/aspnetckbk2/)
This works in 2.0. Haven't tried it in 1.1 Maybe it will give you an idea?
Ken
Microsoft MVP [ASP.NET]
<%@ page language="VB" validaterequest="false" enableviewstate="false" %>
<script runat="server">
Protected Overrides Sub Render _
(ByVal writer As System.Web.UI.HtmlTextWriter)
Const OUTPUT_FILENAME As String = "renderedpage.html"
Dim renderedOutput As StringBuilder = Nothing
Dim strWriter As IO.StringWriter = Nothing
Dim tWriter As HtmlTextWriter = Nothing
Dim outputStream As IO.FileStream = Nothing
Dim sWriter As IO.StreamWriter = Nothing
Dim filename As String
Try
'create a HtmlTextWriter to use for rendering the page
renderedOutput = New StringBuilder
strWriter = New IO.StringWriter(renderedOutput)
tWriter = New HtmlTextWriter(strWriter)
MyBase.Render(tWriter)
'save the rendered output to a file
filename = Server.MapPath(".") & "\" & OUTPUT_FILENAME
outputStream = New IO.FileStream(filename, _
IO.FileMode.Create)
sWriter = New IO.StreamWriter(outputStream)
sWriter.Write(renderedOutput.ToString())
sWriter.Flush()
writer.Write(renderedOutput.ToString())
Finally
'clean up
If (Not IsNothing(outputStream)) Then
outputStream.Close()
End If
If (Not IsNothing(tWriter)) Then
tWriter.Close()
End If
If (Not IsNothing(strWriter)) Then
strWriter.Close()
End If
End Try
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Capture Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:dropdownlist id="DropDownList1" runat="server">
<asp:listitem>red</asp:listitem>
<asp:listitem>blue</asp:listitem>
<asp:listitem>green</asp:listitem>
</asp:dropdownlist></div>
</form>
</body>
</html>
"Ray Booysen" <rj***********@rjb.za.net> wrote in message
news:uZ**************@TK2MSFTNGP11.phx.gbl...
Hi All
In my ASP.NET project, all my pages inherit from a base class which
extends the Page object. I also have a pdf generator that takes in HTML
Text and will generate a PDF for you. What I want to implement in my
custom Page class is the ability for the page to generate the HTML text of
itself. Can this be done? I have tried looping through all my controls
and rendering them as per your example but am hitting some walls.
Any ideas?
Kind Regards
Ray Booysen
--
Ray Booysen
rj********@rjb.za.net