473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Simple Question - How do I capture Page.Request before Page_Load

Inside of a Page class, how do I capture the Request object values
before the Page_Load event is called of that Page? I have a situation
where I have many server controls on a Page that get created in the
constructor of my Page, but I need them to know about some info that
get's set via the Page_Load from the Request (and even Session for
that matter)

thanks!
Dave
Nov 18 '05 #1
3 2005
Are you looking for Page_Init?

void Page_Init(Object sender, EventArgs e)
{
//Pre page load requests here
}

"malcolm" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
Inside of a Page class, how do I capture the Request object values
before the Page_Load event is called of that Page? I have a situation
where I have many server controls on a Page that get created in the
constructor of my Page, but I need them to know about some info that
get's set via the Page_Load from the Request (and even Session for
that matter)

thanks!
Dave

Nov 18 '05 #2
If I'm not mistaken, during the Page_Init, I don't have access to the
Request.Form, Request.QueryString or Viewstate even because they are
not loaded yet. I'm just new and trying to learn about the Page
Lifecycle. What I should be doing (I think) is trapping the button
click event and put my logic there. I think the button click event is
raised on the server before the Page_Load, but after everything is
loaded which is what I want. Further, this is ASP.NET's whole point I
think, that is, to make everything behave like a "Client-Server" app.

Anyway, I'm simply trying to write a Login and Logoff component (which
every ASP.NET developer ends up writing as an exercise early on I'm
sure) and I'm learning the hard way what Page LifeCycle means and
such. I've since read, in fact, that it's not good to directly access
the Page.Request or Page.Form anymore. Instead, it's good to override
methods that are part of the Page Lifecycle. I'm still learning I
guess!

Thanks,
Dave

"GrantMagic" <gr***@magicalia.com> wrote in message news:<#A**************@TK2MSFTNGP11.phx.gbl>...
Are you looking for Page_Init?

void Page_Init(Object sender, EventArgs e)
{
//Pre page load requests here
}

"malcolm" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
Inside of a Page class, how do I capture the Request object values
before the Page_Load event is called of that Page? I have a situation
where I have many server controls on a Page that get created in the
constructor of my Page, but I need them to know about some info that
get's set via the Page_Load from the Request (and even Session for
that matter)

thanks!
Dave

Nov 18 '05 #3
If you really want to tap into that stuff after Init but before Page_Load(),
you can implement IPostBackDataHandler (in a web control, I am not sure if
you can do that with a Page control itself) and wait for a call from the
runtime which will call a LoadPostData which gives you a chance to see all
that.
Or you can write a HTTP module to that.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"malcolm" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
If I'm not mistaken, during the Page_Init, I don't have access to the
Request.Form, Request.QueryString or Viewstate even because they are
not loaded yet. I'm just new and trying to learn about the Page
Lifecycle. What I should be doing (I think) is trapping the button
click event and put my logic there. I think the button click event is
raised on the server before the Page_Load, but after everything is
loaded which is what I want. Further, this is ASP.NET's whole point I
think, that is, to make everything behave like a "Client-Server" app.

Anyway, I'm simply trying to write a Login and Logoff component (which
every ASP.NET developer ends up writing as an exercise early on I'm
sure) and I'm learning the hard way what Page LifeCycle means and
such. I've since read, in fact, that it's not good to directly access
the Page.Request or Page.Form anymore. Instead, it's good to override
methods that are part of the Page Lifecycle. I'm still learning I
guess!

Thanks,
Dave

"GrantMagic" <gr***@magicalia.com> wrote in message

news:<#A**************@TK2MSFTNGP11.phx.gbl>...
Are you looking for Page_Init?

void Page_Init(Object sender, EventArgs e)
{
//Pre page load requests here
}

"malcolm" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
Inside of a Page class, how do I capture the Request object values
before the Page_Load event is called of that Page? I have a situation
where I have many server controls on a Page that get created in the
constructor of my Page, but I need them to know about some info that
get's set via the Page_Load from the Request (and even Session for
that matter)

thanks!
Dave

Nov 18 '05 #4

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

Similar topics

0
by: Ming Zhu | last post by:
Hi, all, I'm new to .NET and ASP.NET. I only use .NET Framework 1.0. I'm reading the book "C# developer's guide to ASP.NET". But I find there is no place to download the code used inside this...
1
by: Matthew Wieder | last post by:
Hi - I wanted to capture the enter button on a form since I have a datagrid with the first column being a delete button and if someone hits enter it deletes the first record. I coded: private...
1
by: Lolam | last post by:
Here is my problem, I am using 3 user controls in a page(Test.aspx) which are 1.Header UC 2.Body UC 3.Footer UC HeaderUC has a DropDownList control named "ddlList". On SelectIndexChanged...
2
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings...
6
by: MooreSmnith | last post by:
When I navigate to the next page using Response.Rediect("MyNextPage.aspx") current page Page_Load event is called. What I may wrongly understood is that post back will happen whenever there is any...
0
by: Goober at christianDOTnet | last post by:
I'm wanting to fix the following on a web page without really re-inventing anything. What I have is a vb web page with a radiobuttonlist where I can pick Current or History year. Underneath...
1
by: spammy | last post by:
Hi all, Im having difficulty serving synamically generated PDFs to clients via asp.net. Im using crystal reports to generate them. In my page load I have the following: private void...
2
by: Ralph Krausse | last post by:
My source to my test is below. I am trying to figure out state. I create a int and a Test object and set them to some value on Page_Load. When I click my button on my web page, Button1_Click gets...
19
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.