472,331 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

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 2276
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: joe | last post by:
Hi, I have an aspx page that reads a session variable and loads an appropriate set of user controls. It appears that the user is going to...
2
by: magister | last post by:
Hello I have a default.aspx page with which has an iframe. In the code-behind of the default.aspx page it loads the 'src' attribute of the...
1
by: Paul | last post by:
Would you expect there to be a problem if I used a Page_Load routine in both the header UserControl .ascx file, as well as the base .aspx file? ...
1
by: Bob Loveshade | last post by:
I am looking for an example that shows how to select and highlight multiple rows in a DataGrid. My DataGrid is part of a Web User Control which...
3
by: gellis99 | last post by:
I've searched several discussions on this topic and haven't been able to resolve my issue. I have a function I call within the page_load event of...
11
by: Ranginald | last post by:
This question is about how to handle an .aspx page that references multiple methods and where to store these methods (e.g. one codefile or multiple...
1
by: Ranginald | last post by:
Hi, I have an asp.net project and I am in the process of trying to make it into a truly object-oriented project -- as I have just learned I...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the...
1
by: Dave A | last post by:
I have a problem that I have boiled down to a very simple example. I have a user control that displays a some data from a business object. On one...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...

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.