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

Timing


Hi everyone,

I'm neck deep in ASP.NET and sinking fast ;) Any help much
appreciated.

I have two user controls on a page that I want to communicate with each
other. One control is called RoleList and allows the user to select
the type of view they wish to see on the page. The other control(s) -
sometimes there may be several - then change the stored proc, query etc
they use to extract info from sql.

Therefore, I have set up the RoleList to generate an event and coded
the other control(s) to listen and recieve it.

The problem is timing. I've done some tracing to see what happens and
when:

1 aspx.page Begin Init
2 aspx.page End Init
3 aspx.page Begin LoadViewState
4 aspx.page End LoadViewState
5 aspx.page Begin ProcessPostData
6 aspx.page End ProcessPostData
7 Control ID: RoleList - role was previously set in the viewstate:
tutor
8 Control ID: StudentList - role was previously set in the viewstate:
tutor
9 aspx.page Begin ProcessPostData Second Try
10 aspx.page End ProcessPostData Second Try
11 aspx.page Begin Raise ChangedEvents
12 aspx.page End Raise ChangedEvents
13 aspx.page Begin Raise PostBackEvent
14 Changing role to: Secretary
15 Control ID: RoleList - changed role to: Secretary
16 Control ID: StudentList - changed role to: Secretary
17 aspx.page End Raise PostBackEvent
18 aspx.page Begin PreRender
19 aspx.page End PreRender
20 aspx.page Begin SaveViewState
21 aspx.page End SaveViewState
22 aspx.page Begin Render
23 aspx.page End Render
Line 7 and 8 came from the page_load event in each control.

Line 14 came from the event being fired and the next two is where the
event is caught.

But the Load event (which contains the data binding for the list /
grids etc) for the response has already happened! Therefore the user
must click the role they want to see TWICE!!!

I could probably make some public properties in the base page and
read/write info from them to get around this. But this will mess up my
otherwise quite low coupling and I don't want to.

Thanks in adv.

Mark.

Nov 19 '05 #1
1 1486
m_********@yahoo.com.au wrote in
news:11*********************@f14g2000cwb.googlegro ups.com:

Hi everyone,

I'm neck deep in ASP.NET and sinking fast ;) Any help much
appreciated.

I have two user controls on a page that I want to communicate
with each other. One control is called RoleList and allows the
user to select the type of view they wish to see on the page.
The other control(s) - sometimes there may be several - then
change the stored proc, query etc they use to extract info from
sql.

Therefore, I have set up the RoleList to generate an event and
coded the other control(s) to listen and recieve it.

The problem is timing. I've done some tracing to see what
happens and when:

1 aspx.page Begin Init
2 aspx.page End Init
3 aspx.page Begin LoadViewState
4 aspx.page End LoadViewState
5 aspx.page Begin ProcessPostData
6 aspx.page End ProcessPostData
7 Control ID: RoleList - role was previously set in the
viewstate: tutor
8 Control ID: StudentList - role was previously set in the
viewstate: tutor
9 aspx.page Begin ProcessPostData Second Try
10 aspx.page End ProcessPostData Second Try
11 aspx.page Begin Raise ChangedEvents
12 aspx.page End Raise ChangedEvents
13 aspx.page Begin Raise PostBackEvent
14 Changing role to: Secretary
15 Control ID: RoleList - changed role to: Secretary
16 Control ID: StudentList - changed role to: Secretary
17 aspx.page End Raise PostBackEvent
18 aspx.page Begin PreRender
19 aspx.page End PreRender
20 aspx.page Begin SaveViewState
21 aspx.page End SaveViewState
22 aspx.page Begin Render
23 aspx.page End Render
Line 7 and 8 came from the page_load event in each control.

Line 14 came from the event being fired and the next two is
where the event is caught.

But the Load event (which contains the data binding for the list
/ grids etc) for the response has already happened! Therefore
the user must click the role they want to see TWICE!!!

I could probably make some public properties in the base page
and read/write info from them to get around this. But this will
mess up my otherwise quite low coupling and I don't want to.


Mark,

It looks like you need to conditionally perform the databinding in
two places: the page (or control) load event, and the RoleList
Changed event.

In the page/control Load event, only perform the databinding if the
page has not been posted back. If the page has been posted back,
another event handler is going to be responsible for the databinding
(RoleList Changed, in this case).

In the RoleList Changed event, iterate through all of the controls on
the page, and send a message to all of the StudentList controls.

foreach (Control ctrl in this.Controls)
{
if (ctrl is StudentList)
(ctrl as StudentList).SendAMessage("new role value goes here");
}

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 19 '05 #2

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

Similar topics

1
by: jj | last post by:
I've got one database server that works fine when transferring large amounts of data, but a new one that has been setup seems to want to timeout or drop the connection after a period of time. I've...
10
by: Greg Stark | last post by:
This query is odd, it seems to be taking over a second according to my log_duration logs and according to psql's \timing numbers. However explain analyze says it's running in about a third of a...
7
by: jamie | last post by:
hey all, I am attempting to do motion control for a final project, but I have a concern.... For motion control, timing is everyting, the better it is, the better it works. Currently I am...
9
by: Amir Ghezelbash | last post by:
Hey every body i had a question i am in process of writing an application, where this application needs to check the database on hourly bases to see if they are any information that are needed...
1
by: Novice | last post by:
Hi all, I'm at my wit's end on trying to insert some timing code into the server side code that parses the hashed data contained in the hidden field being submitted to the server I've tried...
3
by: gregory_may | last post by:
I have an application where I am using a System Thread to capture the screen & Broadcast it to clients. Its "working", but the timing on the background thread gets wildly erratic at times. Some...
2
by: Steven D'Aprano | last post by:
The timeit module is ideal for measuring small code snippets; I want to measure large function objects. Because the timeit module takes the code snippet argument as a string, it is quite handy...
2
by: julie.siebel | last post by:
Google apparently ate my original post to this (grr) so this'll be a bit more vague than the initial post, but...*sigh*. Javascript is not my forte, and I apologize for the acky-ness of the...
3
by: CSharpner | last post by:
Is it just me or is everyone having problems with the MSDN site today? It keeps timing out. http://msdn.microsoft.com I've tried from: Oak Ridge, TN A proxy through our company net via...
0
by: Daniel Fetchinson | last post by:
On 4/15/08, Daniel Fetchinson <fetchinson@googlemail.comwrote: BTW, using the following ###################################################################### # CODE TO TEST BOTH...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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
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.