473,387 Members | 1,540 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,387 software developers and data experts.

How to write output of aspx file created to HTML programmatically

G
Hi, I have an aspx file that has a table with a couple of grids in it
that I'm using as a template to build html files(please give me
guidence if there is a better way). I would like to build this page
and then write the html it produces to a file in the asp.net
application. I tried the code below, but it only writes a blank html
file.

Thanks,

C

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try
'set connection stream
'connect
'bind results to a data_grid
'.....

End Try

Me.Response.WriteFile("the_file_I_just_built.htm")

End Sub
Nov 18 '05 #1
2 3958
On 8/17/2004 4:01 PM, G wrote:
Hi, I have an aspx file that has a table with a couple of grids in it
that I'm using as a template to build html files(please give me
guidence if there is a better way). I would like to build this page
and then write the html it produces to a file in the asp.net
application. I tried the code below, but it only writes a blank html
file.

Thanks,

C

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try
'set connection stream
'connect
'bind results to a data_grid
'.....

End Try

Me.Response.WriteFile("the_file_I_just_built.htm")

End Sub


You have to call Render on a control and send the output to an HTML
writer...see this for a simliar function:

http://www.dotnetjohn.com/articles/articleid78.aspx

I might also recommend using an HttpWebRequest to make a separate
request to your page (note you'd need to create a page to do this, don't
do it in the template page, it'll overflow!) and with that you get the
response html as well. Google on that term (HttpWebRequest) to see
xamples...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
G
Craig Deelsnyder <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message news:<ex*************@tk2msftngp13.phx.gbl>...
On 8/17/2004 4:01 PM, G wrote:
Hi, I have an aspx file that has a table with a couple of grids in it
that I'm using as a template to build html files(please give me
guidence if there is a better way). I would like to build this page
and then write the html it produces to a file in the asp.net
application. I tried the code below, but it only writes a blank html
file.

Thanks,

C

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try
'set connection stream
'connect 'bind results to a data_grid
'.....

End Try

Me.Response.WriteFile("the_file_I_just_built.htm")

End Sub


You have to call Render on a control and send the output to an HTML
writer...see this for a simliar function:

http://www.dotnetjohn.com/articles/articleid78.aspx

I might also recommend using an HttpWebRequest to make a separate
request to your page (note you'd need to create a page to do this, don't
do it in the template page, it'll overflow!) and with that you get the
response html as well. Google on that term (HttpWebRequest) to see
xamples...

Thanks for the suggestion, however, I don't think this is quite what I
want. I don't want to export just one grid at a time, but a whole page
with has 2 or 5 grids on them. This html page will be nicely formated
for the public.

If I were to step through what is being developed, it would be
something like this:

1) A seperate page in the asp.net application has an export button.
2) The button event has a loop that then calls this html builder code,
that I'm trying to write, 4 times for the 4 different zones.
3) For each zone an html page is created. Depending on the zone, 2 to
5 grids on the page will be populated and made visible. These html
pages will be created in the direcotory of the asp.net application and
are just plain html files.
4) A seperate ftp program will ftp these files up to our external
server for the public to see.

Thanks,

G
Nov 18 '05 #3

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

Similar topics

0
by: anonieko | last post by:
> > > > Writing an XML document the .Net way If you've been using the .Net Framework for even a week, you know that the kids in Redmond really thought of almost everything, so they're not...
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
1
by: Joel Finkel | last post by:
Folks, I am unable to execute any ASPX files on a Windows 2000 Server, running as a Primary Domain Controller. The error is "Error BC31019: Unable to write to output file '<filename>'" By...
0
by: G | last post by:
Hi, I have an aspx file that has a table with a couple of grids in it that I'm using as a template to build html files(please give me guidence if there is a better way). I would like to build this...
1
by: jeremy.rice | last post by:
Does anyone know if there is a way to programmatically take an aspx page and export it to an html file as if the user had chosen "Save As..." from the File menu in IE? I need to be able to...
8
by: mosscliffe | last post by:
I am an old programmer, but a newbie to Visual Web Developer 2005 - Express Edition I have an .aspx Form Page with an attached Master File and an attached css file. I have scanned a text...
10
by: Ron | last post by:
Hi, I currently am generating a report by to my end user by retrieving data from my back end DB and concatenating strings together and place this string concatenation within a Label control. I...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
3
by: Smithers | last post by:
Just wondering what it would take to cache a copy of the output HTML from a dynamically constructed aspx page before it is sent to the browser. Reason being: the page is constructed of a few user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.