Welcome to Dream.In.Code
Become an Expert!

Join 149,710 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,251 people online right now. Registration is fast and FREE... Join Now!




ASP.NET Includes

 
Reply to this topicStart new topic

ASP.NET Includes

fyrestorm
5 Feb, 2007 - 01:28 PM
Post #1

D.I.C Lover
Group Icon

Joined: 4 Apr, 2002
Posts: 3,103



Thanked: 2 times
Dream Kudos: 228
My Contributions
When I was writing in ASP I used a fair amount of includes:

CODE

<!--#include File="menu.asp" -->


I'd like to know how to do the same thing in ASP.NET

And just as an aside I'm programming in a text editor and I'm not allowed to use visual studio.

Thanks

This post has been edited by fyrestorm: 5 Feb, 2007 - 01:59 PM
User is offlineProfile CardPM
+Quote Post

skyhawk133
RE: ASP.NET Includes
5 Feb, 2007 - 01:32 PM
Post #2

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 15,262



Thanked: 61 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
QUOTE
And just as an aside I'm programming in a text editor and I'm not allowed to use a text editor.


Huh? Are you breaking the rules again?! Your rebel you!!!
User is offlineProfile CardPM
+Quote Post

fyrestorm
RE: ASP.NET Includes
5 Feb, 2007 - 02:00 PM
Post #3

D.I.C Lover
Group Icon

Joined: 4 Apr, 2002
Posts: 3,103



Thanked: 2 times
Dream Kudos: 228
My Contributions
QUOTE(skyhawk133 @ 5 Feb, 2007 - 02:32 PM) *

QUOTE
And just as an aside I'm programming in a text editor and I'm not allowed to use a text editor.


Huh? Are you breaking the rules again?! Your rebel you!!!



no, not breaking rules, doing drugs...yes I'm a rebel wink2.gif

I'm using a text editor and I'm not allowed to use visual studio...

This post has been edited by fyrestorm: 5 Feb, 2007 - 02:03 PM
User is offlineProfile CardPM
+Quote Post

roadfury
RE: ASP.NET Includes
5 Feb, 2007 - 02:19 PM
Post #4

New D.I.C Head
Group Icon

Joined: 5 Feb, 2007
Posts: 11


My Contributions
They're called User Controls now...

First, rename your "menu.asp" file to "menu.ascx" and make sure it's C# compliant (not just straight asp)

Then add the following code to the top of your page:
CODE

<%@ Register TagPrefix="uc1" TagName="mymenu" Src="menu.ascx" %>


Then find where you want to add it to your page and add the following:
CODE

<uc1:mymenu id="myMenu" runat="server"></uc1:mymenu>


That should do it.

You can name the TagPrefix and TagName as you see fit. Just be sure to change them in your page too. I'm not sure about using multiple User Controls (if you can reuse the TagPrefix or not) since I'm still learning myself...


This post has been edited by roadfury: 5 Feb, 2007 - 02:21 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 04:31AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month