I have a very simple web page (ASP.NET) that I am trying to build. On the
web page is a checkbox that enables or disables other controls based upon the
checked status. However, .NET fails to create the event handler for the
CheckedChanged event.
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- 13 2037
Richard,
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" <Ri******@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com... I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to create the event handler for the CheckedChanged event.
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-
Manohar,
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-
"Manohar Kamath" wrote:
Richard,
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" <Ri******@discussions.microsoft.com> wrote in message news:FE**********************************@microsof t.com...I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to create the event handler for the CheckedChanged event.
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-
Manohar,
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-
"Manohar Kamath" wrote:
Richard,
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" <Ri******@discussions.microsoft.com> wrote in message news:FE**********************************@microsof t.com...I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to create the event handler for the CheckedChanged event.
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-
Richard,
do you have viewstate enabled/disabled? The event wiring in asp.net is
based on having viewstate enabled
-Stefan
As far as manually adding the handler - are you re-adding the handler on
every load of the page? You need to.
You might want to reinstall VS.NET. I don't think what you are experiencing
is typical.
"Richard W" <Ri******@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com... I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to create the event handler for the CheckedChanged event.
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-
The EnableViewState property for the checkbox is set to True.
"Stefan" wrote: Richard,
do you have viewstate enabled/disabled? The event wiring in asp.net is based on having viewstate enabled
-Stefan
The handler is being created in the InitializeComponent() section. Are you
saying that this needs to be moved to the Page_Load section?
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-
"Marina" wrote: As far as manually adding the handler - are you re-adding the handler on every load of the page? You need to.
You might want to reinstall VS.NET. I don't think what you are experiencing is typical.
"Richard W" <Ri******@discussions.microsoft.com> wrote in message news:FE**********************************@microsof t.com...I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to create the event handler for the CheckedChanged event.
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-
Are you having this problem only
- for this specific checkbox control?
- for this specific page?
- or for all controls (buttons/links ...)?
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
If you are manually adding the event handler, then why would it be in
InitializeComponent? That code gets regenerated by VS.NET, you shouldn't be
writing your own code and putting it there.
"Richard W" <Ri******@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com... The handler is being created in the InitializeComponent() section. Are you saying that this needs to be moved to the Page_Load section?
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-
"Marina" wrote:
As far as manually adding the handler - are you re-adding the handler on every load of the page? You need to.
You might want to reinstall VS.NET. I don't think what you are experiencing is typical.
"Richard W" <Ri******@discussions.microsoft.com> wrote in message news:FE**********************************@microsof t.com... >I have a very simple web page (ASP.NET) that I am trying to build. On >the > web page is a checkbox that enables or disables other controls based > upon > the > checked status. However, .NET fails to create the event handler for > the > CheckedChanged event. > > 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-
Could it be because the "Initialize" is never called? See what the page's
"AutoEventWireup" is set to, and switch it between true and false to see if
that makes a difference.
--
Manohar Kamath
Editor, .netBooks www.dotnetbooks.com
"Richard W" <Ri******@discussions.microsoft.com> wrote in message
news:2E**********************************@microsof t.com... Manohar,
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-
"Manohar Kamath" wrote:
Richard,
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" <Ri******@discussions.microsoft.com> wrote in message news:FE**********************************@microsof t.com... >I have a very simple web page (ASP.NET) that I am trying to build. On >the > web page is a checkbox that enables or disables other controls based > upon > the > checked status. However, .NET fails to create the event handler for > the > CheckedChanged event. > > 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-
Marina,
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
Yes, it should fire. But if VS.NET has had a change to regenerate that code,
it may have deleted it. Which is the reason there is that warning there not
to change that method.
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" <Cl*********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com... Marina,
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
Stefan is correct, I manually put the code there because that's where VS.NET
is putting all the other event handler declarations. Tracing the code at
runtime shows that the declaration is being executed. However, the method it
declares never fires when I click the checkbox. Hence, my problem...
-RW-
"Stefan" wrote: Marina,
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Karlo Swart via .NET 247 |
last post by:
Hi.
I am creating a dynamic datagrid. The columns are based on a request.querystring value. Eg: I will pass in a 'func=toys' parameter, which will cause the datagrid to load create columns...
|
by: leon |
last post by:
hello friends, i am writing a page aspx and creating controls dinamicaly and
then
i must to create for each control the events as well.
Anybody to know how?????
happy day
lion
|
by: Alejandro Lapeyre |
last post by:
I am new to c#
In VB when I want to create an event handler for a form control I select the
control in the editor left combo box and
then select from the editor right combo box the event.
How...
|
by: Richard W |
last post by:
I have a very simple web page (ASP.NET) that I am trying to build. On the
web page is a checkbox that enables or disables other controls based upon the
checked status. However, .NET fails to...
|
by: Amit D.Shinde |
last post by:
I am adding a new picturebox control at runtime on the form
How can i create click event handler for this control
Amit Shinde
|
by: JohnR |
last post by:
I have a form with a number of text boxes, comboboxes etc. What I would
like to do is create an event handler for the "mouseenter" event for each of
the controls whereby I display information...
|
by: harish |
last post by:
hello,
I am trying to write code for form activate event and for an event of an
object.
Generally, you select the object/form from the top combo box in visual
studio ide, and select the event...
|
by: LyzH |
last post by:
Someone else had a question on how to emulate a mouse click. I tried posting
in that thread but I have something of a twist on this problem and I'm
really in trouble here! If I don't get help...
|
by: Tuxedo |
last post by:
Is it possible to add a function call to the onUnload event handler from an
external js file, or can this only be done via the body tag?
In any case, I presume there can only exist one onUnload...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |