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

Intercept html before rendering

Not sure if this is the best place for this but here goes...

I'm trying to create a dynamic newsletter generator.
There will be several controls to select from to generate the layout of the
newsletter etc...
Then a preview of the newsletter as generated by a variety of controls, I've
stuck all these in a Panel control just for the sake of being tidy.

THEN comes a simple text box. However, what I want in here is the html
output from the Panel control, i.e. everything that is contained between
those <div> tags that Panel creates.

Theres got to be a simple way of doing this, but I can't make head nor tale
of some of the prerender or rendercontents methods.

P.S. I wont be offended if you treat me like a total novice :D

Thanks in advance,
Adam
Nov 18 '05 #1
6 2767
Adam,

I can't think of a specific way to do this off hand, but I'm guessing that
you'll need to override the Render method on your page class, and handle
your textbox in there (possibly by manipulating the HTML stream). You could
also try overriding the REdners method on your Textbox, which would require
that you create a custom control that inherits from it.

GoodLuck!
-- Alex Papadimoulis

"Adam Smith" <none> wrote in message
news:uF**************@TK2MSFTNGP11.phx.gbl...
Not sure if this is the best place for this but here goes...

I'm trying to create a dynamic newsletter generator.
There will be several controls to select from to generate the layout of the newsletter etc...
Then a preview of the newsletter as generated by a variety of controls, I've stuck all these in a Panel control just for the sake of being tidy.

THEN comes a simple text box. However, what I want in here is the html
output from the Panel control, i.e. everything that is contained between
those <div> tags that Panel creates.

Theres got to be a simple way of doing this, but I can't make head nor tale of some of the prerender or rendercontents methods.

P.S. I wont be offended if you treat me like a total novice :D

Thanks in advance,
Adam

Nov 18 '05 #2

"Adam Smith" <none> wrote in message news:uF**************@TK2MSFTNGP11.phx.gbl...
Not sure if this is the best place for this but here goes...

I'm trying to create a dynamic newsletter generator.
There will be several controls to select from to generate the layout of the
newsletter etc...
Then a preview of the newsletter as generated by a variety of controls, I've
stuck all these in a Panel control just for the sake of being tidy.

THEN comes a simple text box. However, what I want in here is the html
output from the Panel control, i.e. everything that is contained between
those <div> tags that Panel creates.

Theres got to be a simple way of doing this, but I can't make head nor tale
of some of the prerender or rendercontents methods.

P.S. I wont be offended if you treat me like a total novice :D

Thanks in advance,
Adam


If I understand correctly, you have an aspx page (possibly containing ascx's)
and ultimately some Panels. The html-output of this page is the formatted
newsletter you want to send by mail, from within some other page or component.

It is possible to request a page from within your own code to that page
(see System.Net.HttpWebRequest). This way you can get the html generated by
that page, which you can then send by email.

Hans Kesting

Nov 18 '05 #3
Thanks for your responses guys, let me explain a little further:

Page layout:

Web Controls (a couple of checkbox lists currently)

Preview of newsletter (contained in a panel at present)

Textarea (should contain the html of the panel above (and only the panel))
So as you can see... what I really want to do is dynamically create a
newsletter of pure html. Later store this in a db and send them out in
e-mails.
So what I'd like to do, is grab the Panel control before it renders and copy
the text to the textarea control. I'm not married to having it in a Panel,
that was just my initial idea of trying to grab the panel controls output.

p.s. Alex, I'm thinking along the same lines. Something to do with
capturing render data, unfortunately I can't find any practical
demo's of this.
Hans, nice tip, I may have to use that elsewhere :D

----- Original Message -----
From: "Adam Smith" <none>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Wednesday, May 26, 2004 12:27 PM
Subject: Intercept html before rendering

Not sure if this is the best place for this but here goes...

I'm trying to create a dynamic newsletter generator.
There will be several controls to select from to generate the layout of the newsletter etc...
Then a preview of the newsletter as generated by a variety of controls, I've stuck all these in a Panel control just for the sake of being tidy.

THEN comes a simple text box. However, what I want in here is the html
output from the Panel control, i.e. everything that is contained between
those <div> tags that Panel creates.

Theres got to be a simple way of doing this, but I can't make head nor tale of some of the prerender or rendercontents methods.

P.S. I wont be offended if you treat me like a total novice :D

Thanks in advance,
Adam

Nov 18 '05 #4
Adam,

Another solution would of course be to use Client-Side javascript to do it.

<script>
document.getElementById('<%=myTextBox.ClientID%>') .value =
document.getElementById('<%=MyPanel.ClientID%>').i nnerHtml;
</script>

-- Alex Papadimoulis

"Adam Smith" <none> wrote in message
news:e3**************@TK2MSFTNGP10.phx.gbl...
Thanks for your responses guys, let me explain a little further:

Page layout:

Web Controls (a couple of checkbox lists currently)

Preview of newsletter (contained in a panel at present)

Textarea (should contain the html of the panel above (and only the panel))
So as you can see... what I really want to do is dynamically create a
newsletter of pure html. Later store this in a db and send them out in
e-mails.
So what I'd like to do, is grab the Panel control before it renders and copy the text to the textarea control. I'm not married to having it in a Panel, that was just my initial idea of trying to grab the panel controls output.

p.s. Alex, I'm thinking along the same lines. Something to do with
capturing render data, unfortunately I can't find any practical
demo's of this.
Hans, nice tip, I may have to use that elsewhere :D

----- Original Message -----
From: "Adam Smith" <none>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Wednesday, May 26, 2004 12:27 PM
Subject: Intercept html before rendering

Not sure if this is the best place for this but here goes...

I'm trying to create a dynamic newsletter generator.
There will be several controls to select from to generate the layout of

the
newsletter etc...
Then a preview of the newsletter as generated by a variety of controls,

I've
stuck all these in a Panel control just for the sake of being tidy.

THEN comes a simple text box. However, what I want in here is the html
output from the Panel control, i.e. everything that is contained between
those <div> tags that Panel creates.

Theres got to be a simple way of doing this, but I can't make head nor

tale
of some of the prerender or rendercontents methods.

P.S. I wont be offended if you treat me like a total novice :D

Thanks in advance,
Adam


Nov 18 '05 #5
Hi Adam:

I have not tried this with a panel, but I think it should work...

I've used RenderControl with a DataGrid to save the HTML the grid
generates and sent the HTML off in an email. In the easiest case it is
just setting up the correct StringWriter and HtmlTextWriter objects to
save the results.

There is some example code here:

http://odetocode.com/Code/86.aspx

I'd be very interested to hear if this works for your scenario.

HTH,

--
Scott

On Wed, 26 May 2004 12:27:12 +0100, "Adam Smith" <none> wrote:
Not sure if this is the best place for this but here goes...

I'm trying to create a dynamic newsletter generator.
There will be several controls to select from to generate the layout of the
newsletter etc...
Then a preview of the newsletter as generated by a variety of controls, I've
stuck all these in a Panel control just for the sake of being tidy.

THEN comes a simple text box. However, what I want in here is the html
output from the Panel control, i.e. everything that is contained between
those <div> tags that Panel creates.

Theres got to be a simple way of doing this, but I can't make head nor tale
of some of the prerender or rendercontents methods.

P.S. I wont be offended if you treat me like a total novice :D

Thanks in advance,
Adam


--
Scott
http://www.OdeToCode.com
Nov 18 '05 #6
Like a charm, thanks scott.

And thanks to everyone else who responded, all good suggestions.

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:bv********************************@4ax.com...
Hi Adam:

I have not tried this with a panel, but I think it should work...

I've used RenderControl with a DataGrid to save the HTML the grid
generates and sent the HTML off in an email. In the easiest case it is
just setting up the correct StringWriter and HtmlTextWriter objects to
save the results.

There is some example code here:

http://odetocode.com/Code/86.aspx

I'd be very interested to hear if this works for your scenario.

HTH,

--
Scott

On Wed, 26 May 2004 12:27:12 +0100, "Adam Smith" <none> wrote:
Not sure if this is the best place for this but here goes...

I'm trying to create a dynamic newsletter generator.
There will be several controls to select from to generate the layout of thenewsletter etc...
Then a preview of the newsletter as generated by a variety of controls, I'vestuck all these in a Panel control just for the sake of being tidy.

THEN comes a simple text box. However, what I want in here is the html
output from the Panel control, i.e. everything that is contained between
those <div> tags that Panel creates.

Theres got to be a simple way of doing this, but I can't make head nor taleof some of the prerender or rendercontents methods.

P.S. I wont be offended if you treat me like a total novice :D

Thanks in advance,
Adam


--
Scott
http://www.OdeToCode.com

Nov 18 '05 #7

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

Similar topics

13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
71
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's...
81
by: sinister | last post by:
I wanted to spiff up my overly spartan homepage, and started using some CSS templates I found on a couple of weblogs. It looks fine in my browser (IE 6.0), but it doesn't print right. I tested...
1
by: zoltix | last post by:
Hi, I am beginner in JavaScript. I would like to intercept all click events on my document. I use this function for that document.onmousedown=click;. It works well. But I would like to...
0
by: zoltix | last post by:
Hi, I am beginner in aspx. I would like to intercept all click events on my document. I use this function in javascipt for that document.onmousedown=click;. It works well. But I would...
0
by: Ben de Vette | last post by:
Hi, When a user submits a form I want to return him/her a page, but at the same time I want to send him/her an exact copy of this page by mail. Is there a way to intercept the rendered HTML of...
1
by: Ondrej Dobias | last post by:
Hello, I would like to intercept WebBrowser's HTTP requests in order to be able to supply custom login to the proxy server, as well as choose the right certificate for several specific sites. I'm...
0
by: Elroyskimms | last post by:
I'm updating an existing project to send data between pages using Server.Transfer (HTTPContext) instead of response.redirect and querystring parameters. All of my web user controls inherit from a...
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...
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
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
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.