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.N ow)
' display the current year selected (Literal control)
CurrentArchiveY ear.Text = _currentYear.To String()
' build the year selection menu
BuildArchiveMen u()
' build news items
BuildArchiveNew sList()
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? 2 1073
page load fires before any events, read the documentation on the page lifecycle.
-- bruce (sqlwork.com)
"AC" <sp**@aNOSPAMME connell.com> wrote in message news:#b******** ******@TK2MSFTN GP10.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.N ow)
' display the current year selected (Literal control)
CurrentArchiveY ear.Text = _currentYear.To String()
' build the year selection menu
BuildArchiveMen u()
' build news items
BuildArchiveNew sList()
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?
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******** ******@TK2MSFTN GP10.phx.gbl...
page load fires before any events, read the documentation on the page lifecycle.
-- bruce (sqlwork.com)
"AC" <sp**@aNOSPAMME connell.com> wrote in message news:#b******** ******@TK2MSFTN GP10.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.N ow)
' display the current year selected (Literal control)
CurrentArchiveY ear.Text = _currentYear.To String()
' build the year selection menu
BuildArchiveMen u()
' build news items
BuildArchiveNew sList()
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? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 about his work, please feel
free not to read further :-)
There are at least three, no four, no five, no six, no seven reasons why Leo
and Python work so well together. Most are new (in my mind) with the 4.1
release of Leo. The first several...
|
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 display a different
form etc etc.
I want to take the config data and have that read by a globals.asa and
then use application("VariableName") to reference it.
i also want to take the initial query strings and load them into session
variables.
|
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 method of adding
handles to objects (I think that is where my problem lies) . . . sorry
for the long post here is my codebehind and .aspx code. Thank you for
any assistance anyone can offer!
Ryan
Public Class registration_report
|
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 forecolor, backcolor and
font. The labels also are rotatable and the text can also be flipped 180
degrees (the flipped text part is still being worked on). I have one context
menu for all 30 labels that allows for the property changes to the labels....
|
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 config does specify a machinekey setting:
<machineKey
validationKey="447C05E8B3A71401CC4CAE5513A7F1A3494A3618EE819316AAD1D58433F236A759D66FB4154500E01EB4E1BC1DE42046E2D652D391CB8367A1649438867A02EB"...
| |
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 reference the current object (for
example, to get the current object's properties) without using a pre-existing
object on the form (say, Webbrowser1 - again, because these objects are being
created at runtime).
I will attempt to include a code...
|
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 server running PHP
5.x, MySQL 5.x, Apache 2.x
We have been suffering from a number of performance issues. Our
hosting company has set our max connections to 100, and we are using
persistent connections in PHP. At times the mysqld process takes 100%...
|
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 event
handlers may take longer than the interval for either of the timers,
so it's possible for multiple events to fire "simultaneously" and for
events to queue up. I'm attempting to get the timers to sync on some
reference type object, or use...
|
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 Acc2003 MDBs should
work on Vista. However, our particular file has too many problems to
be viable on a Vista platform. Even converting it to an Acc2007 accdb
file has no positive effect.
I realize that Vista is new and should be avoided like the...
|
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:
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |