473,396 Members | 1,810 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,396 software developers and data experts.

page_prerender...when/why to use?

I'm finding references to the use of page_prerender. How does this differ
from page_load?

I've had some issues in the past with setting cookies and then adjusting the
page based on the saved cookie. This is the route I've had to take:

page_load
- read cookie
click button
post back
page.isPostback
grab new values
write cookie
redirect to self

The (minor) problem is that the page executes 3 times: read, write, read new
settings. Would page_prerender help with the above issue at all?

-Darrel
Nov 18 '05 #1
4 1922
My question is - if the code knows what value it is going to write
into the cookie - why do you need to wait for a post back to read the
value?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 20 Oct 2004 22:32:55 -0500, "Darrel" <no*****@nospam.com>
wrote:
I'm finding references to the use of page_prerender. How does this differ
from page_load?

I've had some issues in the past with setting cookies and then adjusting the
page based on the saved cookie. This is the route I've had to take:

page_load
- read cookie
click button
post back
page.isPostback
grab new values
write cookie
redirect to self

The (minor) problem is that the page executes 3 times: read, write, read new
settings. Would page_prerender help with the above issue at all?

-Darrel


Nov 18 '05 #2

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:4n********************************@4ax.com...
My question is - if the code knows what value it is going to write
into the cookie - why do you need to wait for a post back to read the
value?

It's a preference setting, so the order is this:

various controls read the cookie
set the preference widgets to the default value
allow the user to change the widgets
sumbit
rewrite cookie
reload page and read the new settings.

The issue is that there are other userControls dependant on this cookie. So
if I just do the post back, then yes, the current widgets are preserved from
the postback. But since the cookie isn't WRITTEN until the postback, other
controls on the same page don't get the updated value unless the end-user
hits reload.

Hence the need for the redirect.

I hope that made sense ;o)
Nov 18 '05 #3
Hi Darrel:

You could catch PreRender and tweak the properties of each control -
that is the spot to make any final adjustments to the control
properties before display.

Something else you might want to think about is adding the user
controls as member varialbes to your page class and trying to set the
properties without the redirect. You should be able to do this, if I
understand your description.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 21 Oct 2004 00:14:33 -0500, "Darrel" <no*****@nospam.com>
wrote:

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:4n********************************@4ax.com.. .
My question is - if the code knows what value it is going to write
into the cookie - why do you need to wait for a post back to read the
value?

It's a preference setting, so the order is this:

various controls read the cookie
set the preference widgets to the default value
allow the user to change the widgets
sumbit
rewrite cookie
reload page and read the new settings.

The issue is that there are other userControls dependant on this cookie. So
if I just do the post back, then yes, the current widgets are preserved from
the postback. But since the cookie isn't WRITTEN until the postback, other
controls on the same page don't get the updated value unless the end-user
hits reload.

Hence the need for the redirect.

I hope that made sense ;o)


Nov 18 '05 #4
Thanks, Scott...will look into that!

-Darrel

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:bt********************************@4ax.com...
Hi Darrel:

You could catch PreRender and tweak the properties of each control -
that is the spot to make any final adjustments to the control
properties before display.

Something else you might want to think about is adding the user
controls as member varialbes to your page class and trying to set the
properties without the redirect. You should be able to do this, if I
understand your description.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 21 Oct 2004 00:14:33 -0500, "Darrel" <no*****@nospam.com>
wrote:

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:4n********************************@4ax.com. ..
My question is - if the code knows what value it is going to write
into the cookie - why do you need to wait for a post back to read the
value?

It's a preference setting, so the order is this:

various controls read the cookie
set the preference widgets to the default value
allow the user to change the widgets
sumbit
rewrite cookie
reload page and read the new settings.

The issue is that there are other userControls dependant on this cookie.
So
if I just do the post back, then yes, the current widgets are preserved
from
the postback. But since the cookie isn't WRITTEN until the postback, other
controls on the same page don't get the updated value unless the end-user
hits reload.

Hence the need for the redirect.

I hope that made sense ;o)

Nov 18 '05 #5

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

Similar topics

0
by: Cindy X | last post by:
I have a drop-down as usercontrol. In the user control's Page_Init , the drop down gets populated. The SelectedItem.Text is retrived using property get The Value of the drop-down is assigned...
7
by: sql-db2-dba | last post by:
Does DB2 just fudge it when it is an empty table? Is there a "formula" for average row size when you have variable length records. Or you really have to know what your application is packing into...
4
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a...
2
by: TPS | last post by:
I have some dynamic controls (LinkButton) that I am adding to my pages. When the link button is clicked, I am getting an ID from the LinkButton.CommandArguement value. I am then using that ID...
1
by: Sparhawk | last post by:
I ran into troubles binding my repeater controls in Page_PreRender. The problem is that the Repeater_ItemCommand does not fire if the control is bound in Page_PreRender. It works fine if I am...
1
by: Ashish | last post by:
Hi I have been using Page_Load event for a long time . But never used Page_Prerender. I have seen in articles tht whtever u can do in Page_Load can be done in Page_Prerender also.But wht are the...
3
by: windsurfing_stew | last post by:
Hi, Quick question. What's the best way to create the handler for Page_Prerender in ASP.Net 2.0. I used to just use the dropdowns to select (Page Events) on the left and choose PreRender in...
1
by: Max2006 | last post by:
Hi, I have a user control that shows the contents of potentially big html files. To save the server memory, I try to avoid reading the whole large-file's text into a label or literal...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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
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,...

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.