Dynamic Server Side Includes???

laredo512

Regular
Joined
Jan 6, 2004
Messages
88
Location
Far enough to see snow in winter
Hey all,

I got a webform on my site that needs to assign a different server side include depending on the previous page the user was on.

The selection process is good and it works, the only thing remaining is to find a way to add variations of

Code:
<!--#Include virtual="html\top.inc" -->

to my page.

I have tried this:

Code:
[size=2][color=#0000ff]Dim[/color][/size][size=2] q [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Char[/color][/size][size=2] = Chr(34)
 
[/size]me.lblTop.text = [size=2]"<!--#Include virtual=" & q & "html\top.inc" & q & " -->"[/size]
[size=2]
[/size]


Any help would be appreciated.

Thanks
 
If this is an ASP.NET site you shouldn't be using in includes, you should be using user controls that are easy to add dynamically.
 
A public cookies?
or you can write a special type file in the temp director,save the user's information in it .
The another server's site can use the temp file..
 
Because the #include will spawn the old ASP engine if I remember correctly. Not to mention it's a maintnance nightmare... it's just bad practice to mix classic ASP with ASP.NET and there are some mentions of it out there being a performance hit. This is how you load a user control dynamically:

Preferably you have a place holder control, or a panel, or somewhere to load it specifically.

Then:

Me.MyPlaceHolder.Controls.Add(LoadControl("~/Folder/Control.ascx"))

or in C#:

this.MyPlaceHolder.Controls.Add(LoadControl("~/Folder/Control.asxc"));

MyPlaceHolder in this example represents a place holder control already on the form. Use any control you'd like that allows controls to be added.

If these weren't dynamic controls you'd just drag them on the form and designer from the solution explorer.
 
bri189a said:
Because the #include will spawn the old ASP engine if I remember correctly. Not to mention it's a maintnance nightmare... it's just bad practice to mix classic ASP with ASP.NET and there are some mentions of it out there being a performance hit. This is how you load a user control dynamically:

Preferably you have a place holder control, or a panel, or somewhere to load it specifically.

Then:

Me.MyPlaceHolder.Controls.Add(LoadControl("~/Folder/Control.ascx"))

or in C#:

this.MyPlaceHolder.Controls.Add(LoadControl("~/Folder/Control.asxc"));

MyPlaceHolder in this example represents a place holder control already on the form. Use any control you'd like that allows controls to be added.

If these weren't dynamic controls you'd just drag them on the form and designer from the solution explorer.
Thanks, I'll be trying that
 
Back
Top