Parse ASCX Controls into HTML from Code?

  • Thread starter Thread starter Mike Kline
  • Start date Start date
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
 
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!
*************************************************
 
You could certainly write something like this

Could you elaborate more on that??

Thanks!

MK
 
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/
 
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]
 
Back
Top