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