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

Issues with handing server events...

AC
I have a page where I'm displaying articles based on the current year selected. My page dynamically builds a few links at the top to select a different year than the current one selected (the current year is not shown as an option). Then, based on the year selected, I am performing some specific logic to display the articles. By default, the first time the page loads, I default to the current year.

Within my Page_Load, I have the following:
If Not IsPostBack Then
_currentYear = Year(DateTime.Now)

' display the current year selected (Literal control)
CurrentArchiveYear.Text = _currentYear.ToString()

' build the year selection menu
BuildArchiveMenu()

' build news items
BuildArchiveNewsList()
End If

When it loads the very first time, everything works just fine (the display that is). But when someone clicks on one of the year selectors in the menu (LinkButton controls with a bound event), the event isn't fired. I moved some things around (took everything out of the IF stmt above except the _currentYear line ant put it after the IF) to make sure it was firing and it was, but it seems the Page_Load is firing BEFORE my event handler as my page was loading without error, but the articles weren't being written (because it wasn't getting the current year from the event handler).

I must be doing something wrong with my order of events... ideas?
Nov 18 '05 #1
2 1063
page load fires before any events, read the documentation on the page lifecycle.

-- bruce (sqlwork.com)

"AC" <sp**@aNOSPAMMEconnell.com> wrote in message news:#b**************@TK2MSFTNGP10.phx.gbl...
I have a page where I'm displaying articles based on the current year selected. My page dynamically builds a few links at the top to select a different year than the current one selected (the current year is not shown as an option). Then, based on the year selected, I am performing some specific logic to display the articles. By default, the first time the page loads, I default to the current year.

Within my Page_Load, I have the following:
If Not IsPostBack Then
_currentYear = Year(DateTime.Now)

' display the current year selected (Literal control)
CurrentArchiveYear.Text = _currentYear.ToString()

' build the year selection menu
BuildArchiveMenu()

' build news items
BuildArchiveNewsList()
End If

When it loads the very first time, everything works just fine (the display that is). But when someone clicks on one of the year selectors in the menu (LinkButton controls with a bound event), the event isn't fired. I moved some things around (took everything out of the IF stmt above except the _currentYear line ant put it after the IF) to make sure it was firing and it was, but it seems the Page_Load is firing BEFORE my event handler as my page was loading without error, but the articles weren't being written (because it wasn't getting the current year from the event handler).

I must be doing something wrong with my order of events... ideas?
Nov 18 '05 #2
AC
Thanks... was having trouble locating the order of events on rendering an ASP.NET page... lifecycle was the search keyword I needed.
"bruce barker" <no***********@safeco.com> wrote in message news:uI**************@TK2MSFTNGP10.phx.gbl...
page load fires before any events, read the documentation on the page lifecycle.

-- bruce (sqlwork.com)

"AC" <sp**@aNOSPAMMEconnell.com> wrote in message news:#b**************@TK2MSFTNGP10.phx.gbl...
I have a page where I'm displaying articles based on the current year selected. My page dynamically builds a few links at the top to select a different year than the current one selected (the current year is not shown as an option). Then, based on the year selected, I am performing some specific logic to display the articles. By default, the first time the page loads, I default to the current year.

Within my Page_Load, I have the following:
If Not IsPostBack Then
_currentYear = Year(DateTime.Now)

' display the current year selected (Literal control)
CurrentArchiveYear.Text = _currentYear.ToString()

' build the year selection menu
BuildArchiveMenu()

' build news items
BuildArchiveNewsList()
End If

When it loads the very first time, everything works just fine (the display that is). But when someone clicks on one of the year selectors in the menu (LinkButton controls with a bound event), the event isn't fired. I moved some things around (took everything out of the IF stmt above except the _currentYear line ant put it after the IF) to make sure it was firing and it was, but it seems the Page_Load is firing BEFORE my event handler as my page was loading without error, but the articles weren't being written (because it wasn't getting the current year from the event handler).

I must be doing something wrong with my order of events... ideas?
Nov 18 '05 #3

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

Similar topics

50
by: Edward K. Ream | last post by:
I would like to say a few (actually more than a few) words here about some recent discoveries I have made concerning the interaction of Leo and Python. If you don't want to hear an inventor enthuse...
10
by: Woody | last post by:
I have a page that is linked into by other pages that pass it query strings, it then reads a config file, displays 1 of several forms, gets posted to itself, depending upon users response may...
1
by: Ryan McLean | last post by:
Hi everyone! What is happening is the method: sub_btnSubmitClicked is being executed every time any other object with a Handler is executed. I am trying not to use the withevents and handles...
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
1
by: Andy Slovak | last post by:
Hello! I am instantiating webbrowser control objects and runtime and have successfully been able to have the event handled by a shared delegate. In the event handling code, I would like to...
1
by: marcfischman | last post by:
Please help. I have a website running on a linux/apache/mysql/php server. I receive about 8,000-10,000 visitors a day with about 200,000 to 300,000 page views. The server is a RedHat Linux...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
62
by: Tony Ciconte | last post by:
I have a rather complex commercial Acc2003 application (tab controls, 50K+ lines of VBA code, etc.) that will not run well at all on Windows Vista Ultimate. I have seen posts indicating that...
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
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
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,...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.