I'm going to try to do it better.
Much better. Thank you. You are right that you still didn't post a
complete example, but at least now you've made clear that you're writing
ASP.NET code, and talking about .aspx code as well as .cs code. As I
said, context is everything.
As for the questions...
[...]
I'm wondering if I need something like:
SelectedIndexChanged += lstFiles_SelectedIndexChanged;
or does the attribute actually wire the event. If it does not, what does
it
accomplish?
The AutoEventWireup attribute causes the framework to hook up events
automatically _if it's set to "true"_. When it's "false", you have to do
the work yourself. But (important): the AutoEventWireup attribute applies
to the page, not necessarily controls contained within.
If you have an event handler attribute (i.e. "OnSelectedIndexChanged=...")
declared in your ASP.NET control element, then AFAIK it _should_ in fact
get hooked up automatically, even if the containing page's AutoEventWireup
attribute is "false".
And then there is the question about the following in the code behind.:
protected void Page_Load(object sender, EventArgs e)
It has no attributes in the .aspx file relating to it. Do I need to
subscribe to the event explicity?
See above. If you've set AutoEventWireup to "false", then yes...you need
to explicitly subscribe events for the page.
Is it:
Page.Load+=Page_Load;
Placed where?
You can subscribe to the event in any code-behind code associated with the
page instance. In that case, the code would reside in the class for the
page itself, so it would be "this.Load += Page_Load", or even just "Load
+= Page_Load". You can put that in the constructor, in an override of the
OnInit() method, or any other suitable place where you expect code to be
executed on initialization (or later, if you don't need the event hooked
up immediately, but instead in response to something else that happens).
I have a C# book, maybe it too big, but I can't find the answers. I know
he
must cover it but I might have to read all 1300 pages to find it.
I recommend the MSDN web site. It's not always the most clear, and in
rare cases is even inaccurate, but it is _the_ definitive source of
information. It took me almost no time at all to find these links:
http://support.microsoft.com/kb/324151
http://support.microsoft.com/kb/814745
http://msdn.microsoft.com/en-us/library/ms178492(VS.85).aspx
http://msdn.microsoft.com/en-us/library/system.web.configuration.pagessection.autoeventwireup.aspx
Spend some time learning how to navigate around the MSDN web site, and I
think you'll find it's much easier to find information than trying to
browse through a book (especially one with a poor index, or incomplete
content).
Pete