laredo512 Posted January 8, 2006 Posted January 8, 2006 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 <!--#Include virtual="html\top.inc" --> to my page. I have tried this: [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 Quote Laredo512 * using VS.NET Pro 2003 *
Mister E Posted January 8, 2006 Posted January 8, 2006 Why not just modify the include file to dynamically display the conditional content? Quote
laredo512 Posted January 8, 2006 Author Posted January 8, 2006 Because it's only a switch between french and english links in plain html and I don't really want to use a database query just for that. Quote Laredo512 * using VS.NET Pro 2003 *
Administrators PlausiblyDamp Posted January 8, 2006 Administrators Posted January 8, 2006 Have you tried using a literal control rather than a label? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
bri189a Posted January 8, 2006 Posted January 8, 2006 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. Quote
laredo512 Posted January 9, 2006 Author Posted January 9, 2006 I tried... but I don't think I got the syntax right... Quote Laredo512 * using VS.NET Pro 2003 *
laredo512 Posted January 9, 2006 Author Posted January 9, 2006 why not includes? they're harmless pieces of html code ? Quote Laredo512 * using VS.NET Pro 2003 *
dgz988 Posted January 9, 2006 Posted January 9, 2006 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.. Quote
laredo512 Posted January 9, 2006 Author Posted January 9, 2006 Thanks guys. I finally decided to code it all in the background with asp labels. Thanks again. Quote Laredo512 * using VS.NET Pro 2003 *
bri189a Posted January 10, 2006 Posted January 10, 2006 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. Quote
laredo512 Posted January 10, 2006 Author Posted January 10, 2006 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 Quote Laredo512 * using VS.NET Pro 2003 *
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.