Include problem

  • Thread starter Thread starter GM
  • Start date Start date
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?
 
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
 
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(...)
 
Back
Top