Howdy all - and seasons greetings
Just wondering, I've recently discovered the PreRender event for .NET (both
for the page and for controls), which seems like a life saver for doing page
data loads that need to occur AFTER event handlers have fired, as well as
after page load and postback. Is this good, bad or common practice?
example
I've got a repeater on the page, and in the header of the repeater I've got
hyperlinks for sorting the repeater and dropdown lists for filtering it, and
therefore the repeater has (I think) to be bound AFTER the hyperlink-click
or dropdownlist-selection-change events, hence pre-render seems to be the
place.
Another case, in the 'job booking system' that I'm building, the job master
needs to be able to change between job master and job worker roles, hence a
role-changing dropdown list at the top of the page, and given the
DDL-selection change events I believe occur after page load, and given in my
case databinding needs to happen after pageload, postback, and after
DDL-selection-change events, PreRender seems to be the ONLY place I can use.
However I've really not seen much about the PreRender event, although there
seems to be a bit around if you're actually searching on the term PreRender.
So I'm slightly hesitant about using it just yet...
Would appreciate any thoughts
Cheers
Matt 3 8116
Matt,
Technically, you can databind in PreRender. But...
This event is the last stop before the page gets sent to the client. At this
stage it is already supposed to be fully bound, built, etc. You can do some
format changes, calculations, set final values of the page. That is what the
event for. Databinding here is out of place.
I seem to make difference between a page load and a postback. There is no
such a difference. A postback causes Page_Load event.
True, all change events handlers get called after Page_Load. But you don't
have to wait until the change event handler runs. Already in Page_Load event
you can read all control values, including the current selection of the
dlls. I use this approach in my programs. I hardly use any change events. It
is enough if you set AutoPostback=tr ue, then any change will cause a
postback which will trigger Page_Load event in which you can read current
values of the ddls.
Eliyahu
"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:O0******** *****@TK2MSFTNG P15.phx.gbl... Howdy all - and seasons greetings
Just wondering, I've recently discovered the PreRender event for .NET (both for the page and for controls), which seems like a life saver for doing page data loads that need to occur AFTER event handlers have fired, as well as after page load and postback. Is this good, bad or common practice?
example
I've got a repeater on the page, and in the header of the repeater I've got hyperlinks for sorting the repeater and dropdown lists for filtering it, and therefore the repeater has (I think) to be bound AFTER the hyperlink-click or dropdownlist-selection-change events, hence pre-render seems to be the place.
Another case, in the 'job booking system' that I'm building, the job master needs to be able to change between job master and job worker roles, hence a role-changing dropdown list at the top of the page, and given the DDL-selection change events I believe occur after page load, and given in my case databinding needs to happen after pageload, postback, and after DDL-selection-change events, PreRender seems to be the ONLY place I can use. However I've really not seen much about the PreRender event, although there seems to be a bit around if you're actually searching on the term PreRender. So I'm slightly hesitant about using it just yet...
Would appreciate any thoughts
Cheers Matt
Why don't you bound your datas directly into your events handlers ?
Matt, i use PreRender is a similar fashion...not necessarily with binding,
but I could see that happening.
I have an user control which display an article information. The articleId
is passed in as a property. I'm linkbuttons to select which article to
display. My user control can't load the details in Page_Load because
that'll fire before my linkbutton's eventhandler has gone off. Instead, i
use prerender to fetch the article based on the passed in id and set a bunch
of Text properties.
karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:O0******** *****@TK2MSFTNG P15.phx.gbl... Howdy all - and seasons greetings
Just wondering, I've recently discovered the PreRender event for .NET (both for the page and for controls), which seems like a life saver for doing page data loads that need to occur AFTER event handlers have fired, as well as after page load and postback. Is this good, bad or common practice?
example
I've got a repeater on the page, and in the header of the repeater I've got hyperlinks for sorting the repeater and dropdown lists for filtering it, and therefore the repeater has (I think) to be bound AFTER the hyperlink-click or dropdownlist-selection-change events, hence pre-render seems to be the place.
Another case, in the 'job booking system' that I'm building, the job master needs to be able to change between job master and job worker roles, hence a role-changing dropdown list at the top of the page, and given the DDL-selection change events I believe occur after page load, and given in my case databinding needs to happen after pageload, postback, and after DDL-selection-change events, PreRender seems to be the ONLY place I can use. However I've really not seen much about the PreRender event, although there seems to be a bit around if you're actually searching on the term PreRender. So I'm slightly hesitant about using it just yet...
Would appreciate any thoughts
Cheers Matt This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alireza Ziai |
last post by:
I have problem with prerender event in my page I dont know why prerender event occurs immediatley after Load event , I have same problem with Unload event too ,is it a problem with framework or sth ?
|
by: DalePres |
last post by:
Does anyone know if there is a known bug or workaround, or other solution to
this problem?
I have a page with several imagebutton server controls and needed to
handle the PreRender event in C#. In all my tests, on several pages and
circumstances, the Init and PreRender events never fire for the image
button.
If I add a regular button server control, or several regular button server
controls, and the PreRender and Init events fire as...
|
by: wardy |
last post by:
I've got a .NET web application running in .NET 1.1 on IIS 5 with SQL
Server 2000. I've noticed that at times the page rendering is
delayed, and when I run the trace I see that the begin prerender event
takes anywhere from 0.2-5.0 seconds, whereas all the other events take
in the range of 0.000XX seconds. Does anyone know what is happening
in the begin prerender event that might be causing this delay (as a
note, I've found that when I...
|
by: wardy |
last post by:
Hi, I'm hoping someone can lend me a hand....I've got a .NET Web app
running on Windows 2000 IIS 5.0 linking to a SQL Server 2000 database.
When the database is located on the same server as the web app, the
pages render quickly - however, when I run the app with the database
on its own server, the page rendering takes anywhere from 5-8 seconds,
and when I enable tracing on the application, it appears to be the
begin prerender event that...
|
by: Selden McCabe |
last post by:
I have a base page class, from which all pages in my project inherit.
In the base page prerender event, I would like to know which page is being
loaded.
But when I do this.ID, it return null.
How can I determine the page ID during prerender?
Thanks!
---Selden
| |
by: John Scott |
last post by:
Hey I've got an odd problem here.
I have two user controls on a single page. Here is the flow of my page
Page(OnLoad)
UC1(OnPreRender)
UC2(OnPreRender)
Page(ButtonClick)
UC1(OnPreRender)
UC2....NOTHING
|
by: Joe |
last post by:
Hello All:
I have been bitten a few times lately as I've tried to implement
functionality in the Page_PreRender event.
So here is my question: for what purpose do you use the PreRender event?
How do you decide whe to use the PreRender event vs the Unload event?
Any respnse will be welcome.
|
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= |
last post by:
i'm not sure how the preRender event gets handled.
if i have a function:
protected void tbPasswordPreRender(object sender, EventArgs e)
{
tbPswd1.Attributes = tbPswd1.Text;
tbPswd2.Attributes = tbPswd2.Text;
}
and set the two text boxes Prerender event to this single function will it
fire twice?
|
by: tshad |
last post by:
In VS 2008, I have 2 pages, one aspx page and one ascx page.
The PreRender event is not firing on the Contol page.
The aspx page starts out:
<%@ Page Language="VB" AutoEventWireup="true" Trace="true"
CodeFile="TakeSurveyTest.aspx.vb" Inherits="TakeSurveyTest" %>
And the ascx page starts out:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |