By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,492 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,492 IT Pros & Developers. It's quick & easy.

Event handler not being created

P: n/a
I am working on a new ASP.NET web application (with C# as the underlying
language) using VisualStudio.NET 2003 Enterprise Architect. I am also pretty
much a newbie at this stuff, having been a VFP programmer for lo these many
years. Please be kind, I may not use the exact proper terminology for the
problems I am about to describe, but I'll try to be as descriptive as
possible.

I placed a new CheckBox on a form and under Properties went to the
CheckedChanged event and double clicked it. This caused the IDE to create the
following code:

private void CheckBox1_CheckedChanged(object sender, System.EventArgs e)
{

}

However, the code to assign the delegate for the event (which, I believe, is
supposed to be placed by the IDE in the InitializeCompnent() section) was not
created. Furthermore, even if I manually create the delegate assignation and
place it in the InitializeComponent() section, the Click event never fires at
runtime.

Obviously, this makes it impossible for a CheckBox to be used to enable or
disable other controls on the form, and this is a requirement I must meet.
Any and all help in this matter is greatly appreciated - right now I'm kind
of dead in the water...

Thanks,

-RW-
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
> place it in the InitializeComponent() section, the Click event never
fires at
runtime.

Did you set the AutoPostback property on the checkbox to true?

By default it is turned off, which means that changes to the checkbox are
not posted back to the server. The server can't fire events it doesn't
know about :)

Greetings,
Wessel
Nov 17 '05 #2

P: n/a
"Wessel Troost" wrote:
Did you set the AutoPostback property on the checkbox to true?

Wessel, thank you for your reply. Yes, the AutoPostback property has been
set to True. Curiously enough, you can see the page flash as it goes back to
the server and is then re-painted, and the Checkbox then loses it's check
mark. Placing a Break at the Click event never gets hit, the code simply
never fires and the dependent controls Enable/Disable status never changes.
Very frustrating. Placing a break in the InitializeComponent() section shows
the event delegate being assigned, but the Click event never fires.

Thanks again for your reply - anyone else out there have any ideas as to
what is going on?
Nov 17 '05 #3

P: n/a
> Thanks again for your reply - anyone else out there have any ideas as to
what is going on?

Two more ideas:
- Is the enableViewstate property for the page true?
- Is the event wired to the control?
(Click control in design view ->
Properties -> Events and see if the handler shows up.)

Greetings,
Wessel

Nov 17 '05 #4

P: n/a
Wessel, thanks again for your help.

I believe that we have isolated the problem here (Hallelujah!!) Apparently,
some standard User Controls supplied by another team and placed onto my form
were causing all sorts of issues. The offending controls have now been
removed and the IDE appears to be behaving properly.

-RW- Back in the saddle again!!
Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.