473,473 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2341
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 different pages when in reality it is the same page with...
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 iframe. The iframe loads another aspx page, but...
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? For example, I want to use a ADO statement with a...
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 is contained in an ASPX page. I haven't been...
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 a page. This function makes a call to the...
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 codefiles). PREFACE ======== I have a simple...
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 cannot have multiple codebehind files in a single...
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 ASPX page multiple times and each user control will...
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 screen I have a collection of these business...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.