473,597 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Failure to create event handler

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-
Nov 19 '05 #1
13 2066
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(objec t sender, EventArgs e)
{
}

check for a line something like:

myControl.Load+ = new EventHandler(My Handler);

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******@discu ssions.microsof t.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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-

Nov 19 '05 #2
Manohar,

Thanks for the speedy reply! Here is the code I am using:
This is in the InitializeCompo nent()
this.CheckBox1. CheckedChanged += new EventHandler(Ch eckBox1_Checked Changed)

This is the code that *should* fire when the CheckBox is clicked

private void CheckBox1_Check edChanged(objec t sender, System.EventArg s 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(objec t sender, EventArgs e)
{
}

check for a line something like:

myControl.Load+ = new EventHandler(My Handler);

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******@discu ssions.microsof t.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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-


Nov 19 '05 #3
Manohar,

Thanks for the speedy reply! Here is the code I am using:
This is in the InitializeCompo nent()
this.CheckBox1. CheckedChanged += new EventHandler(Ch eckBox1_Checked Changed)

This is the code that *should* fire when the CheckBox is clicked

private void CheckBox1_Check edChanged(objec t sender, System.EventArg s 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(objec t sender, EventArgs e)
{
}

check for a line something like:

myControl.Load+ = new EventHandler(My Handler);

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******@discu ssions.microsof t.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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-


Nov 19 '05 #4
Richard,

do you have viewstate enabled/disabled? The event wiring in asp.net is
based on having viewstate enabled

-Stefan

Nov 19 '05 #5
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******@discu ssions.microsof t.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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-

Nov 19 '05 #6
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

Nov 19 '05 #7
The handler is being created in the InitializeCompo nent() 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******@discu ssions.microsof t.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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-


Nov 19 '05 #8
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.Chec kedChanged")?

The code you posted definitely looks ok

Nov 19 '05 #9
If you are manually adding the event handler, then why would it be in
InitializeCompo nent? That code gets regenerated by VS.NET, you shouldn't be
writing your own code and putting it there.

"Richard W" <Ri******@discu ssions.microsof t.com> wrote in message
news:CC******** *************** ***********@mic rosoft.com...
The handler is being created in the InitializeCompo nent() 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******@discu ssions.microsof t.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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-


Nov 19 '05 #10

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

Similar topics

0
1013
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 specific to a toys xml file I pass in. I have a problem with the sort functionality. I have created the sorting command handler and this works fine when the columns are not created dynamically. I successfully create the columns for the datagrid in the...
3
1791
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
3
1586
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 do you do it in c# ? Thank you!
1
329
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 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...
15
26497
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
3
3974
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 about the control they just entered (sort of like an extended tooltip). Now, I can certainly create a separate mouseenter event for each control (too much work, and not very clever), but what I would like to do is somehow create one event that would...
1
1571
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 you want to code for from the right combo box... which would generate a template ready to write code for the event. I am not able to do this with vs.net 2003
4
1835
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 soon, I'm going to fail this class and the class is already dragging down my GPA. I'm taking an introductory visual basic class with an advanced visual basic book and assignments (the department dropped the prerequisite and the class needs one....
3
2171
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 event handler, which can naturally include any number of function calls. I have instances of html pages, with an existing onUnload event handlers and those without. I'd like to cover both instances, if possible, so that if there is an
0
7971
marktang
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...
0
7893
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,...
1
8040
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,...
0
6698
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5436
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();...
0
3889
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...
1
2408
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
1
1495
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1243
bsmnconsultancy
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...

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.