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

How to get the current aspx page innerhtml in code-behind

joe
How to get the current aspx page innerhtml in code-behind

e.g.

<htm>....
</html>

all content
Oct 21 '06 #1
3 8762
You can get the page output by grabbing the render event to put the rendered
output into a string.

protected override void Render(HtmlTextWriter output)
{
StringWriter sw;
HtmlTextWriter htmltw;
sw = new StringWriter();
htmltw = new HtmlTextWriter(sw);
base.Render(htmltw);
StringBuilder temp = sw.GetStringBuilder();
// here do whatever you like with temp
base.Render(output);
}

Its a commonly asked question, so lots of example on google.
--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"joe" <jo*@discussions.microsoft.comwrote in message
news:36**********************************@microsof t.com...
How to get the current aspx page innerhtml in code-behind

e.g.

<htm>....
</html>

all content

Oct 21 '06 #2
joe
Error

An unhandled exception of type 'System.StackOverflowException' occurred in...

"John Timney (MVP)" wrote:
You can get the page output by grabbing the render event to put the rendered
output into a string.

protected override void Render(HtmlTextWriter output)
{
StringWriter sw;
HtmlTextWriter htmltw;
sw = new StringWriter();
htmltw = new HtmlTextWriter(sw);
base.Render(htmltw);
StringBuilder temp = sw.GetStringBuilder();
// here do whatever you like with temp
base.Render(output);
}

Its a commonly asked question, so lots of example on google.
--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"joe" <jo*@discussions.microsoft.comwrote in message
news:36**********************************@microsof t.com...
How to get the current aspx page innerhtml in code-behind

e.g.

<htm>....
</html>

all content


Oct 23 '06 #3
MVP Rick Strahl explains it all very nicely here
http://west-wind.com/weblog/posts/481.aspx

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"joe" <jo*@discussions.microsoft.comwrote in message
news:D8**********************************@microsof t.com...
Error

An unhandled exception of type 'System.StackOverflowException' occurred
in...

"John Timney (MVP)" wrote:
>You can get the page output by grabbing the render event to put the
rendered
output into a string.

protected override void Render(HtmlTextWriter output)
{
StringWriter sw;
HtmlTextWriter htmltw;
sw = new StringWriter();
htmltw = new HtmlTextWriter(sw);
base.Render(htmltw);
StringBuilder temp = sw.GetStringBuilder();
// here do whatever you like with temp
base.Render(output);
}

Its a commonly asked question, so lots of example on google.
--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"joe" <jo*@discussions.microsoft.comwrote in message
news:36**********************************@microso ft.com...
How to get the current aspx page innerhtml in code-behind

e.g.

<htm>....
</html>

all content



Oct 23 '06 #4

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

Similar topics

0
by: Jim Mitchell | last post by:
I like to display my web site in a window so that users can use the "Send Page" function in IE to mail their output using their client side Outlook program. The problem is that I always get an...
31
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and...
0
by: Eustice Scrubb | last post by:
In line coding problem. Here's my code: <script language="VB" runat="server"> Dim myConnection As SqlConnection Sub Page_Load(Src As Object, e As EventArgs) ' Create a connection to the SQL...
3
by: elyob | last post by:
Hi, I'm just wondering how I change some css text when I mouseover a picture. At the moment document.write just writes to a new page. function displayname(name) { document.write(name); }
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
12
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page...
2
by: =?Utf-8?B?YWxiZXJ0b3Nvcmlh?= | last post by:
Hi, I'm using Threads, and when I try to do Server.Transfer, I recieved an error. (child object does not exist...) My Code: Dim t As New Thread(AddressOf Hilo) Private Sub Hilo()...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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,...

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.