dumb question re: includes

wrestolovaa

New Member
In classic ASP I am used to dumping all my presentation elements into the page via include files. I haven't seen any .Net examples that do this Is it still done essentially the same way?<BR><BR>If so, would the include directive go in the .aspx page?I haven't had any problems using includes in a .aspx page. I'm not sure of an asp: tag that exists for includes, however, adding the regular include tag expression will work.<BR><-- #Include VIRTUAL="include.inc" --><BR><BR>Yes you can still do includes in the same classic fashion but you can also do them in a new DotNet method like so.<BR><BR>In the following example I have included a menu that I want to appear at the top of each of my pages.<BR><BR>At the top of your page under the page directive you will need a line similar to this.<BR><%@ Register Tagprefix="MyMenu" Tagname="Menu" src=http://aspmessageboard.com/archive/index.php/"includes/menu.ascx"%><BR><BR>and down in the body of your html where you want your file to appear you can insert a similar line of code.<BR><MyMenu:Menu id="Menu1" runat="server"></MyMenu:Menu><BR><BR>The ascx file is a web form user control file which as far as I can is very much like an aspx which contains it's own code behind, .vb, page.<BR><BR>hth<BR><BR>mattYou can still use includes, but for more functionality, I would look into using User Controls.<BR><BR>Similar to includes, you can use User Controls to replicate standard presentation code (header and footer stuff) across an entire site, however, unlike includes, User Controls expose their own properties and methods for manipulation. Additionally, you can load User Controls programmatically.
 
Back
Top