473,468 Members | 1,354 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Includes in .Net

This may seem like it's in the wrong group, but I can't seem to get a
usable answer in .net groups; and I figure that many of the people on this
group have probably dabbled in ASP.Net

In ASP I use #Includes with functions to build the look of the site.
Something like...

Include.asp
<%
Sub DrawHeader()
%>
<table><tr><td><img src=theHeader.gif></td></tr>
<tr><td valign=top>
<%
End Sub

Sub DrawFooter()
%>
</td></tr></table>
<%
End Sub
%>

Then in all of my pages I just include and call the header and footer
subroutines.

I've asked in the .Net groups how this is done and they all say "just use
user controls" but this doesn't make much sense as far as layout is
concerned. It would require me to build the layout on every page, and if I
decide to make a change, I'd have to change every page.

Any information is appreciated.

Thanks
TomB
Jul 19 '05 #1
4 1347
Use user controls.

I don't understand the part about having to change the layout. How would it
be different than ASP style includes?

Bob Lehmann

"TomB" <sh*****@hotmailXXX.com> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
This may seem like it's in the wrong group, but I can't seem to get a
usable answer in .net groups; and I figure that many of the people on this
group have probably dabbled in ASP.Net

In ASP I use #Includes with functions to build the look of the site.
Something like...

Include.asp
<%
Sub DrawHeader()
%>
<table><tr><td><img src=theHeader.gif></td></tr>
<tr><td valign=top>
<%
End Sub

Sub DrawFooter()
%>
</td></tr></table>
<%
End Sub
%>

Then in all of my pages I just include and call the header and footer
subroutines.

I've asked in the .Net groups how this is done and they all say "just use
user controls" but this doesn't make much sense as far as layout is
concerned. It would require me to build the layout on every page, and if I decide to make a change, I'd have to change every page.

Any information is appreciated.

Thanks
TomB

Jul 19 '05 #2
My understanding of user controls is that they are a chunk of logic. Such
as a login user control.

in my little sample, my include and function calls "draw" the basic page,
then the individual pages create the "body"
This way, if I want to change the whole site, I just edit the Include file.

For example, if my include file had the menu along the top I could move it
to the left side (throughout the site) by merely editing the include file.

If I did this with a user control, I'd have to go into each page and move
the user control to the side.

Am I missing something?

Thanks
TomB

"Bob Lehmann" <none> wrote in message
news:ej**************@TK2MSFTNGP11.phx.gbl...
Use user controls.

I don't understand the part about having to change the layout. How would it be different than ASP style includes?

Bob Lehmann

"TomB" <sh*****@hotmailXXX.com> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
This may seem like it's in the wrong group, but I can't seem to get a
usable answer in .net groups; and I figure that many of the people on this group have probably dabbled in ASP.Net

In ASP I use #Includes with functions to build the look of the site.
Something like...

Include.asp
<%
Sub DrawHeader()
%>
<table><tr><td><img src=theHeader.gif></td></tr>
<tr><td valign=top>
<%
End Sub

Sub DrawFooter()
%>
</td></tr></table>
<%
End Sub
%>

Then in all of my pages I just include and call the header and footer
subroutines.

I've asked in the .Net groups how this is done and they all say "just use user controls" but this doesn't make much sense as far as layout is
concerned. It would require me to build the layout on every page, and
if I
decide to make a change, I'd have to change every page.

Any information is appreciated.

Thanks
TomB


Jul 19 '05 #3
A user control can be just HTML. So you could have a User Control something
like the header I have in my site...

<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="titleBar" width="100%" valign="top" align="left"><a
href="~/default.aspx" runat="server"><img src="~/images/general/logo.gif"
height="60" width="220" border="0" runat="server"></a></td>
</tr>
<tr>
<td width="100%" align="left" valign="top">
<!-- Start Menu Control -->
<ais:menu id="nav" runat="server" />
<!-- End Menu Control -->
</td>
</tr>
<tr>
<td class="content" width="100%" align="left" valign="top">

This contains another User Control for navigation which can go left or right
or center...
"<ais:menu id="nav" runat="server" />"

You can have logic in the code-behind, but you don't have to. For example,
in my menu control I could check the current page and disable the link for
that page.

I don't reallyunderstand why you think you need to call subs to output the
HTML. Even with an include, if you put it in a table cell aligned left, and
you decided to align right, you would still have to change every page.

Here's a couple of groups that may help you

microsoft.public.dotnet.framework.aspnet.webcontro ls
microsoft.public.dotnet.framework.aspnet.buildingc ontrols

Bob Lehmann
"TomB" <sh*****@hotmailXXX.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
My understanding of user controls is that they are a chunk of logic. Such
as a login user control.

in my little sample, my include and function calls "draw" the basic page,
then the individual pages create the "body"
This way, if I want to change the whole site, I just edit the Include file.
For example, if my include file had the menu along the top I could move it
to the left side (throughout the site) by merely editing the include file.

If I did this with a user control, I'd have to go into each page and move
the user control to the side.

Am I missing something?

Thanks
TomB

"Bob Lehmann" <none> wrote in message
news:ej**************@TK2MSFTNGP11.phx.gbl...
Use user controls.

I don't understand the part about having to change the layout. How would

it
be different than ASP style includes?

Bob Lehmann

"TomB" <sh*****@hotmailXXX.com> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
This may seem like it's in the wrong group, but I can't seem to get a
usable answer in .net groups; and I figure that many of the people on this group have probably dabbled in ASP.Net

In ASP I use #Includes with functions to build the look of the site.
Something like...

Include.asp
<%
Sub DrawHeader()
%>
<table><tr><td><img src=theHeader.gif></td></tr>
<tr><td valign=top>
<%
End Sub

Sub DrawFooter()
%>
</td></tr></table>
<%
End Sub
%>

Then in all of my pages I just include and call the header and footer
subroutines.

I've asked in the .Net groups how this is done and they all say "just use user controls" but this doesn't make much sense as far as layout is
concerned. It would require me to build the layout on every page, and

if
I
decide to make a change, I'd have to change every page.

Any information is appreciated.

Thanks
TomB



Jul 19 '05 #4
That's it. Thanks Bob.

"Bob Lehmann" <none> wrote in message
news:OK*************@TK2MSFTNGP11.phx.gbl...
A user control can be just HTML. So you could have a User Control something like the header I have in my site...

<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="titleBar" width="100%" valign="top" align="left"><a
href="~/default.aspx" runat="server"><img src="~/images/general/logo.gif"
height="60" width="220" border="0" runat="server"></a></td>
</tr>
<tr>
<td width="100%" align="left" valign="top">
<!-- Start Menu Control -->
<ais:menu id="nav" runat="server" />
<!-- End Menu Control -->
</td>
</tr>
<tr>
<td class="content" width="100%" align="left" valign="top">

This contains another User Control for navigation which can go left or right or center...
"<ais:menu id="nav" runat="server" />"

You can have logic in the code-behind, but you don't have to. For example,
in my menu control I could check the current page and disable the link for
that page.

I don't reallyunderstand why you think you need to call subs to output the
HTML. Even with an include, if you put it in a table cell aligned left, and you decided to align right, you would still have to change every page.

Here's a couple of groups that may help you

microsoft.public.dotnet.framework.aspnet.webcontro ls
microsoft.public.dotnet.framework.aspnet.buildingc ontrols

Bob Lehmann
"TomB" <sh*****@hotmailXXX.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
My understanding of user controls is that they are a chunk of logic. Such as a login user control.

in my little sample, my include and function calls "draw" the basic page, then the individual pages create the "body"
This way, if I want to change the whole site, I just edit the Include

file.

For example, if my include file had the menu along the top I could move it to the left side (throughout the site) by merely editing the include file.
If I did this with a user control, I'd have to go into each page and move the user control to the side.

Am I missing something?

Thanks
TomB

"Bob Lehmann" <none> wrote in message
news:ej**************@TK2MSFTNGP11.phx.gbl...
Use user controls.

I don't understand the part about having to change the layout. How would
it
be different than ASP style includes?

Bob Lehmann

"TomB" <sh*****@hotmailXXX.com> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
> This may seem like it's in the wrong group, but I can't seem to get
a > usable answer in .net groups; and I figure that many of the people on this
> group have probably dabbled in ASP.Net
>
> In ASP I use #Includes with functions to build the look of the site.
> Something like...
>
> Include.asp
> <%
> Sub DrawHeader()
> %>
> <table><tr><td><img src=theHeader.gif></td></tr>
> <tr><td valign=top>
> <%
> End Sub
>
> Sub DrawFooter()
> %>
> </td></tr></table>
> <%
> End Sub
> %>
>
> Then in all of my pages I just include and call the header and
footer > subroutines.
>
> I've asked in the .Net groups how this is done and they all say

"just use
> user controls" but this doesn't make much sense as far as layout is
> concerned. It would require me to build the layout on every page,
and if
I
> decide to make a change, I'd have to change every page.
>
> Any information is appreciated.
>
> Thanks
> TomB
>
>



Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Tim Tyler | last post by:
A fairly simple question: I have a library A which depends on library B and C. Currently I have: <?php include("A.inc.php"); include("B.inc.php"); include("C.inc.php");
2
by: Joe Mowry | last post by:
First off, I'm posting this question for a friend that doesn't have access to the news groups. Problem: Using PHP as the base and has several PHP < includes > for various functions, all this...
4
by: Patrick | last post by:
I have an ASP site with about 50 ASP files, all of which are currently including a common "includes.asp" file near the top of the file, responsible for generating the <HEAD/> section of the HTML ...
4
by: Generic Usenet Account | last post by:
I am seeing some unexpected behavior while using the STL "includes" algorithm. I am not sure if this is a bug with the template header files in our STL distribution, or if this is how it should...
2
by: David Muoio | last post by:
I am trying to validate an XML file against an XSD that is stored in the assembly as an embedded resource. I can get it to work as long as the XSD does not include other XSDs. After a fair amount...
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
3
by: Jeff | last post by:
I have an asp page. Now I know this is sortof OT, but I am not sure of the forum to get an answer. I have an include on this asp page <!-- #include file=\forum\includes\consts-inc.asp --> ...
4
by: Ron | last post by:
Hi all, Trying to work out a few problems in using php on my site. Partially this is a html question. I was reading a lot of the posts and it seems that some of the includes people are using are...
1
by: JRough | last post by:
I have includes at the top of the file and I have inline includes also includes in mysql queries. For example: include './includes/config.inc.php'; include $include_path.'dates.inc.php';...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.