Parse ASCX Controls into HTML from Code?

M

Mike Kline

Hi There!

Is it possible to parse (execute) the User Controls (ASCX) from VB.NET code
in ASP.NET?

For example, is there any objects in ASP.NET that allow me to do something
like...

strHTML = <<Object>>.Parse ("MyUserControl.ascx")

and get the output HTML string into strHTML variable?

Or am I wishing the impossible? :D

Many thanks!!!

MK
 
C

Cowboy \(Gregory A. Beamer\)

You could certainly write something like this, but there is certainly no
"automatic" way in the Framework. Ultimately, the Framework compiles and
renders controls, so you can certainly poke and do the same.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside the box!
*************************************************
 
M

Mike Kline

You could certainly write something like this

Could you elaborate more on that??

Thanks!

MK
 
?

=?ISO-8859-1?Q?=22Anders_Nor=E5s_=5BMCAD=5D=22?=

Mike said:
Is it possible to parse (execute) the User Controls (ASCX) from VB.NET code
in ASP.NET?

For example, is there any objects in ASP.NET that allow me to do something
like...

strHTML = <<Object>>.Parse ("MyUserControl.ascx")

and get the output HTML string into strHTML variable?
If you want to render a user control you can use the Render method. This
method takes an HtmlTextWriter as an argument and the resulting HTML
output to the TextWriter used by the HtmlTextWrtier.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
W

Willie

Mike,

Use TemplateControl.LoadControl(FileName), which returns a Control. Then use Control.RenderControl to get HTML.

Willie

nntp://news.microsoft.com/microsoft.public.dotnet.framework.aspnet/<[email protected]>

Hi There!

Is it possible to parse (execute) the User Controls (ASCX) from VB.NET code
in ASP.NET?

For example, is there any objects in ASP.NET that allow me to do something
like...

strHTML = <<Object>>.Parse ("MyUserControl.ascx")

and get the output HTML string into strHTML variable?

Or am I wishing the impossible? :D

Many thanks!!!

MK




[microsoft.public.dotnet.framework.aspnet]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top