469,282 Members | 1,947 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Multiple Page_load

Is there a way to do put Page_loads on a page?

I am trying to setup a Page_Load that just puts a persons name that is
logged on at the top of a page the first time a page is loaded.

In my template (which would be copied to each page) would have this in it.
The each page has its own Page handling for the first time it is loaded,
also Page_load.

This seems to work fine if it is in a User Control.

Thanks,

Tom
Nov 19 '05 #1
4 2174
A couple options:

1. Wire to the Page.Load event that way it will remain seperate from each
page's Load method.
2. Derive all your pages from myPages.myPage. And in myPage, do your load
logic. Each derived class (page) will have the name logic on load called,
but won't see it, nor will you have to worry about updating X number pages,
if you are copying and pasting it.

bill
"tshad" <ts**********@ftsolutions.com> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is there a way to do put Page_loads on a page?

I am trying to setup a Page_Load that just puts a persons name that is
logged on at the top of a page the first time a page is loaded.

In my template (which would be copied to each page) would have this in it.
The each page has its own Page handling for the first time it is loaded,
also Page_load.

This seems to work fine if it is in a User Control.

Thanks,

Tom

Nov 19 '05 #2
"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
A couple options:

1. Wire to the Page.Load event that way it will remain seperate from each
page's Load method.
2. Derive all your pages from myPages.myPage. And in myPage, do your
load
logic. Each derived class (page) will have the name logic on load called,
but won't see it, nor will you have to worry about updating X number
pages,
if you are copying and pasting it.
Not quite sure how to do that.

I am not using code/behind at the moment, so not sure if that is an issue.

Why does the user control not have a problem?

Tom
bill
"tshad" <ts**********@ftsolutions.com> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is there a way to do put Page_loads on a page?

I am trying to setup a Page_Load that just puts a persons name that is
logged on at the top of a page the first time a page is loaded.

In my template (which would be copied to each page) would have this in
it.
The each page has its own Page handling for the first time it is loaded,
also Page_load.

This seems to work fine if it is in a User Control.

Thanks,

Tom


Nov 19 '05 #3
Since you are not using codebehind, you should just be able to define a
Page_Load method. The following code is in C#

<%@Page Language="C#">

<!-- All your html code in here -->

<script runat="server">
void Page_Load( object sender, EventArgs e )
{
//set the label in here.
}

</script>

Is this what you are after?

bill

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
A couple options:

1. Wire to the Page.Load event that way it will remain seperate from each page's Load method.
2. Derive all your pages from myPages.myPage. And in myPage, do your
load
logic. Each derived class (page) will have the name logic on load called, but won't see it, nor will you have to worry about updating X number
pages,
if you are copying and pasting it.


Not quite sure how to do that.

I am not using code/behind at the moment, so not sure if that is an issue.

Why does the user control not have a problem?

Tom

bill
"tshad" <ts**********@ftsolutions.com> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is there a way to do put Page_loads on a page?

I am trying to setup a Page_Load that just puts a persons name that is
logged on at the top of a page the first time a page is loaded.

In my template (which would be copied to each page) would have this in
it.
The each page has its own Page handling for the first time it is loaded, also Page_load.

This seems to work fine if it is in a User Control.

Thanks,

Tom



Nov 19 '05 #4
"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:ub**************@TK2MSFTNGP09.phx.gbl...
Since you are not using codebehind, you should just be able to define a
Page_Load method. The following code is in C#

<%@Page Language="C#">

<!-- All your html code in here -->

<script runat="server">
void Page_Load( object sender, EventArgs e )
{
//set the label in here.
}

</script>
No.

I already do that.

My problem is I really want 2 Page_Load functions (I know - a little
greedy). Normally each page has mostly different Page_Load events.

My problem is when the page first loads. It the "not IsPostBack" section
that I am really interested in. I have a few things, such as check to see
if my session is still current by check to see if one of my session cookies
is there. If not - I need to go off to a new page to handle the problem.

At the moment, I have to add the code in by hand for each page I build to
check to see if the session is live.

I am using templates in Dreamweaver and wanted to add a small section of
code to the area you can't touch that runs this code when the page loads to
check the session (as well as a couple of other items).

The best place (as far as I know) is in the Page_Load area. But if I put
the Page_Load event in the templates area, I can't use it in the other part
of the pages.

I hope I am explaining this correctly.

Thanks,

Tom
Is this what you are after?

bill

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
>A couple options:
>
> 1. Wire to the Page.Load event that way it will remain seperate from each > page's Load method.
> 2. Derive all your pages from myPages.myPage. And in myPage, do your
> load
> logic. Each derived class (page) will have the name logic on load called, > but won't see it, nor will you have to worry about updating X number
> pages,
> if you are copying and pasting it.


Not quite sure how to do that.

I am not using code/behind at the moment, so not sure if that is an
issue.

Why does the user control not have a problem?

Tom
>
> bill
>
>
> "tshad" <ts**********@ftsolutions.com> wrote in message
> news:uD**************@tk2msftngp13.phx.gbl...
>> Is there a way to do put Page_loads on a page?
>>
>> I am trying to setup a Page_Load that just puts a persons name that is
>> logged on at the top of a page the first time a page is loaded.
>>
>> In my template (which would be copied to each page) would have this in
>> it.
>> The each page has its own Page handling for the first time it is loaded, >> also Page_load.
>>
>> This seems to work fine if it is in a User Control.
>>
>> Thanks,
>>
>> Tom
>>
>>
>
>



Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by joe | last post: by
2 posts views Thread by magister | last post: by
1 post views Thread by Bob Loveshade | last post: by
3 posts views Thread by gellis99 | last post: by
11 posts views Thread by Ranginald | last post: by
1 post views Thread by Ranginald | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.