Inline Expression Resolution

D

Darin

Hi everyone:

I have a particular situation where I'd like to serve up the content of
essentially static html coming out of a database for a website.

I've created a generic user control to actually handle retrieving the
html text and I've overridden the RENDER method to render the html at
the point the control is rendered (the static text actually sits inside
a master template page and the static control is dynamically created on
the master page)

All this works fine as it is.

However, I'd like to be able to use small inline expressions (of the
form
<%= FunctionName() %> at various places in the otherwise static html and
have those expressions evaluated when the page is rendered, just like a
normal ASPX or ASCX page. But that doesn't seem to work, when you write
the text as output through the HTMLTextWriter you get through the RENDER
method

I assume I'm not inserting the html early enough in the rendering
pipeline.

Would anyone have any ideas how to go about doing this (or maybe there's
a better way to accomplish the same thing that I'm not familiar with?

Thanks
Darin
 
H

Harolds

Instead of using Render, place the html into the text property of a literal,
then your html will display, and your code will execute when the page is
rendered.
 

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,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top