473,396 Members | 2,057 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.

Rendering a page Without openning it in a Window

HVG
Hi, is it possible to render a whole page (ie. a aspx webform) to a string
_without_ actually loading the page in a window? Eg if Iam executing
page1.aspx at the server, I would then like to render page2.aspx to a string
_without_ returning to the client.

I currently happily override the Render property of a page and capture its
html that way, but so far this requires me to postback to the client and
open the page in a little window, render it to a string and save it to
Session, then immediately close the window. It creates a "flash" on the
screen & it looks bad (and is slow too)

I can see how to render a individual server control and capture its html at
any time, but I can't see how to do the same for a whole page/webform. I
have reports that will both be used for displaying info on a browser and for
sending html via email.

Thanks for any help!
Hugo
Nov 17 '05 #1
4 1382
Hi
Hi, is it possible to render a whole page (ie. a aspx webform) to a string
_without_ actually loading the page in a window? Eg if Iam executing


Try this:

StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
Page.RenderControl(htmlWriter);
string output = stringWriter.ToString();

Hi
Giorgio
Nov 17 '05 #2
HVG
Thanks for the reply, but I can't see how to make the page to be rendered
(the "Page" obj in your code) the webform I wish to render.
My senario is that from the code in page1.aspx, I wish to render page2.aspx
(ie. a totally a different page) to html.
Am I making any sense?! Thanks.
"Giorgio Parmeggiani" <gi******@gipadotnet.com> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
Hi
Hi, is it possible to render a whole page (ie. a aspx webform) to a string _without_ actually loading the page in a window? Eg if Iam executing


Try this:

StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
Page.RenderControl(htmlWriter);
string output = stringWriter.ToString();

Hi
Giorgio

Nov 17 '05 #3
Just do HttpRequest to the page. The httprequest.response will contain the
html.

"HVG" <hvg2000@hot_nospam_mail.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
Thanks for the reply, but I can't see how to make the page to be rendered
(the "Page" obj in your code) the webform I wish to render.
My senario is that from the code in page1.aspx, I wish to render page2.aspx (ie. a totally a different page) to html.
Am I making any sense?! Thanks.
"Giorgio Parmeggiani" <gi******@gipadotnet.com> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
Hi
Hi, is it possible to render a whole page (ie. a aspx webform) to a string _without_ actually loading the page in a window? Eg if Iam executing


Try this:

StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
Page.RenderControl(htmlWriter);
string output = stringWriter.ToString();

Hi
Giorgio


Nov 17 '05 #4
HVG
Thanks I will try this too (as well as server.execute)
Hugo
"Rajesh.V" <Ra***********@hotmail.com> wrote in message
news:e4**************@TK2MSFTNGP10.phx.gbl...
Just do HttpRequest to the page. The httprequest.response will contain the
html.

"HVG" <hvg2000@hot_nospam_mail.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
Thanks for the reply, but I can't see how to make the page to be rendered (the "Page" obj in your code) the webform I wish to render.
My senario is that from the code in page1.aspx, I wish to render

page2.aspx
(ie. a totally a different page) to html.
Am I making any sense?! Thanks.
"Giorgio Parmeggiani" <gi******@gipadotnet.com> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
Hi

> Hi, is it possible to render a whole page (ie. a aspx webform) to a

string
> _without_ actually loading the page in a window? Eg if Iam executing
Try this:

StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
Page.RenderControl(htmlWriter);
string output = stringWriter.ToString();

Hi
Giorgio



Nov 17 '05 #5

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

Similar topics

5
by: Tedmond | last post by:
Dear all, How can I get all the titles of all openning windows? I found a API in win32 that called EnumWindows() but it returns only the windows handles, not titles. How can I get the list just...
2
by: HVG | last post by:
My previous post on this didnt quite find a solution, so can we try again please? My senario is that from the codebehind in "page1.aspx", I wish to render "page2.aspx" (ie. a totally a...
2
by: Mr. x | last post by:
Hello, I want to activate an aspx page from the client. just oppening the url from html page (client), ie openning the page with parameter : my_url.aspx?my_param=1 Thanks :)
5
by: Dave A | last post by:
I am writing an ASP.NET tool that will allow the client to create their own online froms. ie the client can add tect boxes, text, drop downs,etc with absolutely no technical skill what so ever....
4
by: tobfon | last post by:
I'm creating a scientific visualization application with rather high demands on performance. I've created a nice rendering engine for it in C++/OpenGL and a python interface to the rendering...
0
by: Jeff Morgan | last post by:
I have an application that runs on ASP.NET. We have been working through performance testing and it appears that at about 40-50 users, I start to get CPU bound. The application is a three form,...
2
by: Gamboz Matteo | last post by:
Hi all, I'm writing a widget that should enable the user to choose some item from a huge list that has a tree structure (~23000 items, node with max children = ~1600 kids (only 3 levels in the...
12
by: Boris Borcic | last post by:
Hello, I am trying to use UI Automation to drive an MS Windows app (with pywinauto). I need to scrape the app's window contents and use some form of OCR to get at the texts (pywinauto can't...
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?
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
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.