In addition, even if I manually create the event handler, the CheckedChanged
event is never executed at runtime. AutoPostBack is set to True. Sometimes,
.NET "loses" blocks of code that I have painstakingly created.
And, just to add to my fun, the IDE consistently goes "whacky" on me -
reserved words lose their highlighting in the middle of editing and
IntelliSense refuses to display lists of the events and methods for objects.
I am using Visual Studio .NET 2003 Enterprise Architect with ASP.NET and C#.
Microsoft Development Environment 2003 Version 7.1.3088 and Microsoft .NET
Framework Version 1.1.4322 SP1
My PC (Dell OptiPlex GX280, 512MB RAM) is running Win2K Pro (Version 5,
Build 2195, SP4).
I must admit that I am VERY frustrated with this product - the IDE is buggy
as hell. If my company didn't insist upon using .NET, I would switch back to
VFP and be done with this nonsense once and for all.
Any help that is offered is *greatly* appreciated.
-RW-
Per haps you can show us your code, and we could help you figure out why the
event handler was never executed. The one major reason why it might be the
case is, the event handler was not registered with the control. This happens
if you remove the control from the page, using the IDE. So, if your event
handler looks like this
private void MyHandler(object sender, EventArgs e)
{
}
check for a line something like:
myControl.Load+= new EventHandler(MyHandler);
In almost all cases I have seen the event handlers not firing, the absence
of the above line has been the cause. The cause for this cause, is when you
remove a control from the page (in IDE), the IDE also removes all the
registered event handlers for that control.
Hope that helps!
--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com
"Richard W" <Rich...@discussions.microsoft.com> wrote in message
news:FEF9D36F-CD19-447D...@microsoft.com...
Thanks for the speedy reply! Here is the code I am using:
>> This is in the InitializeComponent()
this.CheckBox1.CheckedChanged += new EventHandler(CheckBox1_CheckedChanged)
>> This is the code that *should* fire when the CheckBox is clicked
private void CheckBox1_CheckedChanged(object sender, System.EventArgs e)
{
Debug.WriteLine("Checkbox1 was changed...");
}
This code never fires.
-RW-
do you have viewstate enabled/disabled? The event wiring in asp.net is
based on having viewstate enabled
-Stefan
You might want to reinstall VS.NET. I don't think what you are experiencing
is typical.
"Richard W" <Rich...@discussions.microsoft.com> wrote in message
news:FEF9D36F-CD19-447D...@microsoft.com...
I have re-installed VS.NET 2 times in the past week - that was a ton of fun,
can't wait to do it again <g>.
-RW-
Also, do you do anything else "fancy" which could manipulate your
viewstate?
E.g. are you dynamically injecting controls to your page (ie. a page
decorator)
using an http module or any other mechanism? If so, this could corrupt
your
viewstate (which would lead to your event not firing) ...
Also, is there any other code that clears the CheckedChange delegate
(search for "CheckBox1.CheckedChanged")?
The code you posted definitely looks ok
"Richard W" <Rich...@discussions.microsoft.com> wrote in message
news:CC3F94E5-4278-42E4...@microsoft.com...
--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com
"Richard W" <Rich...@discussions.microsoft.com> wrote in message
news:2E3A2546-E65B-47E0...@microsoft.com...
VS.Net is generating event handlers within the InitializeComponent()
method.
I understand Richard just added it manually because VS.Net did not add
it
in VS.Net.
At runtime it doesn't matter who put the code in InitializeComponent -
be it Richard, be it VS.Net, since the code looks ok, the event should
fire.
Regards
-Stefan
My point was just that manually adding the handler should work just fine.
And that maybe the reason it isn't working is because it is being deleted
when the designer code is regenerated.
"Stefan" <Clown...@gmail.com> wrote in message
news:1122399388....@g14g2000cwa.googlegroups.com...
-RW-