473,659 Members | 2,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET V1.1 Headers and footers help

Hey,
this is probbly a really simple answer, but im useing ASP.NET V1.1 and
im trying to create a dynamic header, but a static footer. But i dont
want to use place holders. thou its probbly the best way.

What i am doing is useing Response.write, so heres a example

Function.vb
---------------------------------------------------------------------------
---------------
Public Function Header(strTitle as string, bolUserLoggedIn as Boolean)
as string
Header = ("<html><head>< title>" & strTitle & "</title></head><body>")
If bolUserLoggedIn = True Then
Header += ("Welcome: " & strUser & "<br> <a
href='/logout.aspx'>Lo gOut</a>")
Else
Header += ("Welcome, Please <ahref='/login.aspx'>log in</a>")
end if
End Function

Public Function Footer() as String
Footer = ("Created By: <br> </body> </html>")
End Function

index.aspx.vb
---------------------------------------------------------------------------
-------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Response.Write( Header("Test Page",UserLogge dIn))

Response.Write( Footer)
End Sub

index.aspx (Just got a button on at the moment that dont do anything)
---------------------------------------------------------------------------
----------------
<form runat="server" ID="Form1">
<asp:button id="Test" runat="server" Text="Test"></asp:button>
</form>

That is what i am doing, but as the page is loading, it is putting the
header and footer, then the body. So is there anyway that i can have it

going Header Body Footer. Thou liek i said i dont really want to use
palce holders. but also i dont want to ahve to write the whole of hte
body out for each page, in response.write

So whats the best method of creating headers and footers. i have read
so many different ways, and quite a few ways of useing Placeholders,
but it has jsut confused me.

Also another reason i have used response,write for the header is
because of the title, so you might be in the same page, but the title
will change for the users.

Also i would like to be able to use response.write for other things in
the web page, but without them being placed at the top of the page, but

below the header.

I cant use ASp.NET V1.1 else i would just use a masterpage, its got to
be Version 1.1 sorry.

Regards, and Thank You In Advance
Chris

Jun 16 '06 #1
3 1951
if you override the page onrender event you can manage this

override void OnRender(HtmlTe xtWriter out)
{
Response.Write( Header("Test Page",UserLogge dIn));
base.OnRender(o ut); // render page controls
Response.Write( Footer() );
}

-- bruce (sqlwork.com)

"Dessip" <De****@gmail.c om> wrote in message
news:11******** *************@r 2g2000cwb.googl egroups.com...
Hey,
this is probbly a really simple answer, but im useing ASP.NET V1.1 and
im trying to create a dynamic header, but a static footer. But i dont
want to use place holders. thou its probbly the best way.

What i am doing is useing Response.write, so heres a example

Function.vb
---------------------------------------------------------------------------
---------------
Public Function Header(strTitle as string, bolUserLoggedIn as Boolean)
as string
Header = ("<html><head>< title>" & strTitle & "</title></head><body>")
If bolUserLoggedIn = True Then
Header += ("Welcome: " & strUser & "<br> <a
href='/logout.aspx'>Lo gOut</a>")
Else
Header += ("Welcome, Please <ahref='/login.aspx'>log in</a>")
end if
End Function

Public Function Footer() as String
Footer = ("Created By: <br> </body> </html>")
End Function

index.aspx.vb
---------------------------------------------------------------------------
-------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Response.Write( Header("Test Page",UserLogge dIn))

Response.Write( Footer)
End Sub

index.aspx (Just got a button on at the moment that dont do anything)
---------------------------------------------------------------------------
----------------
<form runat="server" ID="Form1">
<asp:button id="Test" runat="server" Text="Test"></asp:button>
</form>

That is what i am doing, but as the page is loading, it is putting the
header and footer, then the body. So is there anyway that i can have it

going Header Body Footer. Thou liek i said i dont really want to use
palce holders. but also i dont want to ahve to write the whole of hte
body out for each page, in response.write

So whats the best method of creating headers and footers. i have read
so many different ways, and quite a few ways of useing Placeholders,
but it has jsut confused me.

Also another reason i have used response,write for the header is
because of the title, so you might be in the same page, but the title
will change for the users.

Also i would like to be able to use response.write for other things in
the web page, but without them being placed at the top of the page, but

below the header.

I cant use ASp.NET V1.1 else i would just use a masterpage, its got to
be Version 1.1 sorry.

Regards, and Thank You In Advance
Chris

Jun 16 '06 #2
Hey,

That is excellent thank you. That is deffonatly going to make my life
ALOT easier.

Chris

bruce barker (sqlwork.com) wrote:
if you override the page onrender event you can manage this

override void OnRender(HtmlTe xtWriter out)
{
Response.Write( Header("Test Page",UserLogge dIn));
base.OnRender(o ut); // render page controls
Response.Write( Footer() );
}

-- bruce (sqlwork.com)

"Dessip" <De****@gmail.c om> wrote in message
news:11******** *************@r 2g2000cwb.googl egroups.com...
Hey,
this is probbly a really simple answer, but im useing ASP.NET V1.1 and
im trying to create a dynamic header, but a static footer. But i dont
want to use place holders. thou its probbly the best way.

What i am doing is useing Response.write, so heres a example

Function.vb
---------------------------------------------------------------------------
---------------
Public Function Header(strTitle as string, bolUserLoggedIn as Boolean)
as string
Header = ("<html><head>< title>" & strTitle & "</title></head><body>")
If bolUserLoggedIn = True Then
Header += ("Welcome: " & strUser & "<br> <a
href='/logout.aspx'>Lo gOut</a>")
Else
Header += ("Welcome, Please <ahref='/login.aspx'>log in</a>")
end if
End Function

Public Function Footer() as String
Footer = ("Created By: <br> </body> </html>")
End Function

index.aspx.vb
---------------------------------------------------------------------------
-------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Response.Write( Header("Test Page",UserLogge dIn))

Response.Write( Footer)
End Sub

index.aspx (Just got a button on at the moment that dont do anything)
---------------------------------------------------------------------------
----------------
<form runat="server" ID="Form1">
<asp:button id="Test" runat="server" Text="Test"></asp:button>
</form>

That is what i am doing, but as the page is loading, it is putting the
header and footer, then the body. So is there anyway that i can have it

going Header Body Footer. Thou liek i said i dont really want to use
palce holders. but also i dont want to ahve to write the whole of hte
body out for each page, in response.write

So whats the best method of creating headers and footers. i have read
so many different ways, and quite a few ways of useing Placeholders,
but it has jsut confused me.

Also another reason i have used response,write for the header is
because of the title, so you might be in the same page, but the title
will change for the users.

Also i would like to be able to use response.write for other things in
the web page, but without them being placed at the top of the page, but

below the header.

I cant use ASp.NET V1.1 else i would just use a masterpage, its got to
be Version 1.1 sorry.

Regards, and Thank You In Advance
Chris


Jun 17 '06 #3
ok so im still having problems with that, i have looked for a few days
now, and still not getting anything. I changed the code to VB.Net
because thats the defualt language im doing it in, and here is what i
have got

defualt.aspx
----------------------------------
Protected Overrides Sub Render(ByVal writer As
System.Web.UI.H tmlTextWriter)
Dim pTracker As ProTracker = New ProTracker
writer.Write(pT racker.Header(" Main Page",
Page.User.Ident ity.Name))
MyBase.Render(w riter)
writer.Write(pT racker.Footer)
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Response.Write( "TEST")
End Sub
-----------------------------------
So i thought that, when that ran it would have put test in the middle
of the header and footer like this:

HEADER
----------------
TEST
---------------------
FOOTER

Where as its still doing it like this:

TEST
---------------------
HEADER
---------------------
FOOTER

Am i doing something wrong, just that i would have thought that because
i have override the structre, it would now load the header, then any
code i have got in the code behind, and HTML code, and then added the
footer.

Regards
Chris
bruce barker (sqlwork.com) wrote:
if you override the page onrender event you can manage this

override void OnRender(HtmlTe xtWriter out)
{
Response.Write( Header("Test Page",UserLogge dIn));
base.OnRender(o ut); // render page controls
Response.Write( Footer() );
}

-- bruce (sqlwork.com)

"Dessip" <De****@gmail.c om> wrote in message
news:11******** *************@r 2g2000cwb.googl egroups.com...
Hey,
this is probbly a really simple answer, but im useing ASP.NET V1.1 and
im trying to create a dynamic header, but a static footer. But i dont
want to use place holders. thou its probbly the best way.

What i am doing is useing Response.write, so heres a example

Function.vb
---------------------------------------------------------------------------
---------------
Public Function Header(strTitle as string, bolUserLoggedIn as Boolean)
as string
Header = ("<html><head>< title>" & strTitle & "</title></head><body>")
If bolUserLoggedIn = True Then
Header += ("Welcome: " & strUser & "<br> <a
href='/logout.aspx'>Lo gOut</a>")
Else
Header += ("Welcome, Please <ahref='/login.aspx'>log in</a>")
end if
End Function

Public Function Footer() as String
Footer = ("Created By: <br> </body> </html>")
End Function

index.aspx.vb
---------------------------------------------------------------------------
-------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Response.Write( Header("Test Page",UserLogge dIn))

Response.Write( Footer)
End Sub

index.aspx (Just got a button on at the moment that dont do anything)
---------------------------------------------------------------------------
----------------
<form runat="server" ID="Form1">
<asp:button id="Test" runat="server" Text="Test"></asp:button>
</form>

That is what i am doing, but as the page is loading, it is putting the
header and footer, then the body. So is there anyway that i can have it

going Header Body Footer. Thou liek i said i dont really want to use
palce holders. but also i dont want to ahve to write the whole of hte
body out for each page, in response.write

So whats the best method of creating headers and footers. i have read
so many different ways, and quite a few ways of useing Placeholders,
but it has jsut confused me.

Also another reason i have used response,write for the header is
because of the title, so you might be in the same page, but the title
will change for the users.

Also i would like to be able to use response.write for other things in
the web page, but without them being placed at the top of the page, but

below the header.

I cant use ASp.NET V1.1 else i would just use a masterpage, its got to
be Version 1.1 sorry.

Regards, and Thank You In Advance
Chris


Jun 19 '06 #4

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

Similar topics

2
1942
by: Web Surfer | last post by:
www.authoring.stylesheets] Is it possible to use stylesheets to override the Headers and Footers that are displayed on a printed webpage ?
2
6213
by: Rupe | last post by:
Hi CSS gurus! I have an embarassing problem. I am a php programmer and I try to expound the advantages of css on the php newsgroups. However, after telling someone that they should use css to solve their problem, I am having trouble coming up with the goods! + I would like to know the answer too.
28
14037
by: reneecccwest | last post by:
hello, how can I remove IE headers and footers when I print a page? I'd like to use a code to remove them, not thru the IE page setup. s/RC
3
1992
by: Chris Transcend | last post by:
Hi all, I'm writing my first .NET website and am wondering what the best method for including headers and footers is. I was thinking either a user or server control but am not sure which would be best performance-wise / maintenance wise. OR if there is another approach that is more commonly followed. I'm interested in performance mainly, but not at the expense of being able to maintain the headers within reason. I'm coming from the...
1
2565
by: Kenneth | last post by:
Hi, In IE6 you can configure output to the printer getting a clean printout only with content, but without headers and footers. You remove the Header and Footer content from the Page Setup. But when you've done that, you have to know how to get those values back unless you've saved them somewhere for later retrieval. What I need is a way to programmatically print out a page on a printer with only the content and that the next time the user...
1
2619
by: Dan Sikorsky | last post by:
Under the File menu, Page Setup item in the IE is a way to setup the Page headers and footers the show when you print a page in the browser. How can we set those programmatically in a webform? -- Thank you kindly, Dan Sikorsky BAB, BScE, MSC
7
6867
by: Robert Adkison | last post by:
I need to print a web page. It is my preference that my users just do a File/Print from explorer. That way my users will get the print dialog that will allow them to select the fax printer. The only problem with doing this is that a header (name of the page and Page x of x) and footer (actual page filename the date) are included. I am proficient with using Crystal Reports v10 (developers version) which will create a PDF file for you to...
1
5916
by: Joao_H | last post by:
I am trying to save and print reports of calculations of a program that make adjustments. Doing that for a Word Document is fine because we can format the text from VB .NET. I have already all the results in a word document, but I would like to put a Header and a Footer and page numbers on the document. However I don’t have the finest idea how to make that!! From VBA I can do that, but the instructions that put Header and Footer...
0
1632
by: steve | last post by:
I am looking for a way to create dynamic headers and footers in a web form. There are .Net PDF products that convert web form content into PDF format and insert dynamic headers/footers. I'm just wondering if there is a similar way of accomplishing this in a web form by inserting a CSS page break. Is there a way to roughly limit each printed page to 7.0 ~ 7.5 inches of content?
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8525
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
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 we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.