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

Inline Expression Resolution

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
Nov 19 '05 #1
2 1231
in aspx, the inline expression are evaluated when the page is compiled the
first time.

for example

<html>
<body>
<% printHello(); %>
</body>
</html>

get compiled to (pseudo code)

_renderPage(HtmlTextWriter __output)
{
__output.Write("<html>\r\nbody\r\n");
printHello();
__output.Write("\r\n</body>\r\n</html>\r\n");
}

the compiled code is loaded into memory, then called.

a coomon way to do what you want is to use webclient to callback into you
website to render the static page. you can also use the asp.net runtime to
compile your page, and get an object handle.

-- bruce (sqlwork.com)
"Darin Higgins" <ne****@tweakvb.com> wrote in message
news:Xn*******************@216.196.97.136...
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

Nov 19 '05 #2
Interesting question. I dont have a sample but maybe this will get you in
the right direction :

"
Capturing content from another Page in the Current Application

If you need to capture content from another page altogether you can take
advantage of a very powerful function in the Server object: Server.Execute().
Server.Execute() let's you run another ASP.Net page, pass in a TextWriter
object and then return control back to the current page, which can then retrieve
the TextWriter and its content easily.
"

Its from http://west-wind.com/weblog/posts/481.aspx

Using that approuch you could present asp.net the database content as a page.
Maybe you first have to dump the content to a physical file but I think its
also possible to skip this intermediate stage but haven't tried something
like this.

Hope this hepls a bit.. Let me know how it goes.

Cheers,
Tom Pester
Nov 19 '05 #3

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

Similar topics

15
by: Dave Townsend | last post by:
Yo, I had a job interview today, the interviewing asked me about inline virtual functions, or what was my opinion on them. Hm, I've seen mention of these babies in the reference material, but...
11
by: Johannes Bauer | last post by:
Hi group, inspired by the other inline assembly thread a question popped up in my mind... Victor Bazarov mentioned in his response that the asm() clause was covered by the C++ standard,...
4
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
5
by: dilip ranganathan | last post by:
Hi I have taken the liberty to cross-post this. It appeared on c.l.c++.m but the ICE is regarding VS.NET 7.1 C++ compiler. post follows: ==============================================...
4
by: Wendy Elizabeth | last post by:
I have the following questions about VB.NET interfacing with sql server 2000: 1. I have heard that VB.NET can run with inline SQL. Can you show me how to use inline sql to access a sql server 2000...
23
by: Shane Hathaway | last post by:
Here's a heretical idea. I'd like a way to import modules at the point where I need the functionality, rather than remember to import ahead of time. This might eliminate a step in my coding...
19
by: Riko Wichmann | last post by:
hi everyone, I'm googeling since some time, but can't find an answer - maybe because the answer is 'No!'. Can I call a function in python inline, so that the python byte compiler does...
9
by: chinu | last post by:
hi all, i did a small experiment to grasp the advantages of declaring a function as inline. inline int fun1(); int main(){ unsigned int start=0,end=0; asm("rdtsc\n\t"
12
by: sam_cit | last post by:
Hi Everyone, I have few questions on inline functions, when i declare a function as inline, is it for sure that the compiler would replace the function call with the actual body of the function?...
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
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
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
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...

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.