Event handler not being created

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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-
 
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
 
Wessel Troost said:
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?
 
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
 
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!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top