473,397 Members | 2,033 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.

ObjectDataSource_Load and Page_Load events - What Order?

Greetings

Hopefully, I can be clear and concise on this one, but I'm confused.

I have a page with a ListBox <- ODS <- BusinessObject and a button.

The Parameter Source is 'None'. The Default Value is left blank. Both are
set in the Page_Load (myODS.SelectParameters[0].DefaultValue = 999)

I put Debug statements in the Page_Load, ODS_Load and method of my
BusinessObject.

On the first time through, I get the following order:
Page_Load
ODS_Load
BusinessObject Method fires

Exactly as expected.

However, on the second post of the page (when I press the button) the order
is as follows:
BusinessObject Method fires(with NO PARAMETERS)
Page_Load
ODS_Load
BusinessObject Method fires (this time with Parameters set)

The additional firing of the BO Method is causing lots of problems (not
least of which is the loss of the SelectedItem on the ListBox).

As you can imagine, this took hours to track down.

Other info:
ODS.EnableCaching = False
ListBox.EnableViewState = True

I've played around with my Page_Load for hours. But of course, it doesn't
get hit until AFTER the ODS_Load.

I can code round this issue, but to be honest it just seems plain wrong to
me. Firing my BO method twice like this is something I just don't want.

Any help hugely appreciated.

Regards

M.

MCDBA : MCSD
Apr 15 '07 #1
1 1823
Hi Mikey,

There must be something wrong with your code as ODS should call business
object select method only if value for one of the select parameters changed
between postback. Please also note Objectdatasourece onload event is useless
(it actually doesn’t do anything interesting) because the control (list box
in this case) is responsible for restoring data from its view state , of
course if the object data source state has not changed. have also in mind
data binding for all controls that have DataSourceID set, occurs inside
OnPreRender event and ODS is only used to provide the data in form of
IEnumerable from Select() method. Could you please paste the code so we could
see what you’re doing wrong...

Regards
--
Milosz
"Mikey Baby" wrote:
Greetings

Hopefully, I can be clear and concise on this one, but I'm confused.

I have a page with a ListBox <- ODS <- BusinessObject and a button.

The Parameter Source is 'None'. The Default Value is left blank. Both are
set in the Page_Load (myODS.SelectParameters[0].DefaultValue = 999)

I put Debug statements in the Page_Load, ODS_Load and method of my
BusinessObject.

On the first time through, I get the following order:
Page_Load
ODS_Load
BusinessObject Method fires

Exactly as expected.

However, on the second post of the page (when I press the button) the order
is as follows:
BusinessObject Method fires(with NO PARAMETERS)
Page_Load
ODS_Load
BusinessObject Method fires (this time with Parameters set)

The additional firing of the BO Method is causing lots of problems (not
least of which is the loss of the SelectedItem on the ListBox).

As you can imagine, this took hours to track down.

Other info:
ODS.EnableCaching = False
ListBox.EnableViewState = True

I've played around with my Page_Load for hours. But of course, it doesn't
get hit until AFTER the ODS_Load.

I can code round this issue, but to be honest it just seems plain wrong to
me. Firing my BO method twice like this is something I just don't want.

Any help hugely appreciated.

Regards

M.

MCDBA : MCSD
Apr 15 '07 #2

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

Similar topics

13
by: z. f. | last post by:
Hi, i have a class that is derived from System.Web.UI.Page, and this is the class i use in my application as PageBase. all other page classes are deriverd from my PageBase instead of the...
3
by: Studio P.M. | last post by:
Dear colleagues, I kindly ask the C# developers community to help me to REALLY understand the Page_Load event, so to REALLY have it under control. Reason for this question is that I cannot...
2
by: Rebecca | last post by:
I have a dynamically created command button on a .net page that adds 1 row to a sql server table when clicked. The page_load event load rows from that table for the user to view, but for some reason...
2
by: Frank Schumacher | last post by:
Hi Folks, I have a problem with the order of events fired by ASP.NET. I found many articles which explaining the lifecycle of a site, but I found none which took the event from a Control on the...
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
2
by: Dave | last post by:
Hi, this is a follow-up to an earlier question but I really haven't found a definitive answer in my search If I have a Base and Derived webform, I've found that the dervived Page_Load event...
2
by: Opa | last post by:
Hi, I have a form with a javacript function that I wish to call before the Page_Load event on the server side. The function is called in the onload of window (ie. window.onload = "myfunction()"...
1
by: cmay | last post by:
Can someone advise on this issue? We are seeing a page where, on the first load the base page (the class our page inherits from) fires it's PageLoad event first, followed by our Page's PageLoad....
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
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...
0
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...

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.