473,467 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
Create 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'>LogOut</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.EventArgs) Handles MyBase.Load
Response.Write(Header("Test Page",UserLoggedIn))

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 1943
if you override the page onrender event you can manage this

override void OnRender(HtmlTextWriter out)
{
Response.Write(Header("Test Page",UserLoggedIn));
base.OnRender(out); // render page controls
Response.Write(Footer() );
}

-- bruce (sqlwork.com)

"Dessip" <De****@gmail.com> wrote in message
news:11*********************@r2g2000cwb.googlegrou ps.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'>LogOut</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.EventArgs) Handles MyBase.Load
Response.Write(Header("Test Page",UserLoggedIn))

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(HtmlTextWriter out)
{
Response.Write(Header("Test Page",UserLoggedIn));
base.OnRender(out); // render page controls
Response.Write(Footer() );
}

-- bruce (sqlwork.com)

"Dessip" <De****@gmail.com> wrote in message
news:11*********************@r2g2000cwb.googlegrou ps.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'>LogOut</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.EventArgs) Handles MyBase.Load
Response.Write(Header("Test Page",UserLoggedIn))

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.HtmlTextWriter)
Dim pTracker As ProTracker = New ProTracker
writer.Write(pTracker.Header("Main Page",
Page.User.Identity.Name))
MyBase.Render(writer)
writer.Write(pTracker.Footer)
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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(HtmlTextWriter out)
{
Response.Write(Header("Test Page",UserLoggedIn));
base.OnRender(out); // render page controls
Response.Write(Footer() );
}

-- bruce (sqlwork.com)

"Dessip" <De****@gmail.com> wrote in message
news:11*********************@r2g2000cwb.googlegrou ps.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'>LogOut</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.EventArgs) Handles MyBase.Load
Response.Write(Header("Test Page",UserLoggedIn))

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
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
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...
28
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
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...
1
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...
1
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? ...
7
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...
1
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...
0
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...
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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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: 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...
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.