Include problem

G

GM

I have this include:
<!--#include file="../customer/pages/<%=request("template")%>"-->
the request("template") variable has the value = template.htm
The code above doesn't work (no html is included in the resulting page)

This one does = <!--#include file="../customer/pages/template.htm"-->

Any idea on how to solve this or a workaround?
 
M

Mark Fitzpatrick

You can't do it this way. The include is actually processed before other
inline items.

If you're using ASP.Net, you can instead put the HTML files into ASP.Net Web
User Controls. At the point you would have the include, you can have a
placeholder control. Then, in the page_load event, you can use the
Page.LoadControl() method to load the appropriate user control like so:

Control objControl = Page.LoadControl(Request("template"));

then add the user control to the placeholder

plcPlaceHolder.Controls.Add(objControl);

Of course, this only works with ASP.Net and not classic ASP.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
G

GM

Mark Fitzpatrick said:
You can't do it this way. The include is actually processed before other
inline items.

If you're using ASP.Net, you can instead put the HTML files into ASP.Net
Web User Controls. At the point you would have the include, you can have a
placeholder control. Then, in the page_load event, you can use the
Page.LoadControl() method to load the appropriate user control like so:

Control objControl = Page.LoadControl(Request("template"));

then add the user control to the placeholder

plcPlaceHolder.Controls.Add(objControl);

Of course, this only works with ASP.Net and not classic ASP.

Thanks,

I found a workaround using server.execute(...)
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top