CheckBox CheckChanged Event

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

I have two checkboxes on a form. I changed the Autopostback to "true".
I code for the check change event. When I click one of the checkboxes,
it does perform the Page load event, but does not perform the Check
Change event.

I do not see in the windows generated code (C#) that it generated the
code "register" of the event. Should I? I am using VS.Net, and I would
have thought it would of registered the event. How do I get the event
registered, or is that even my problem?

I added the code for the event as follows....

I first Double click on the Event and that created the "method pattern".
I then changed the name of this method, as I was going to call it from
several places. I then went back in the IDE and pasted the new name
there in all of the controls that I needed the method for...

Thanks in advance for your assistance!!!!!!!!!
 
Do you handle !IsPostBack. For post back to work you must handle all the
initialization of the page in if(!IsPostBack)
Shimon
 
In the code-behind page, there should be a Web Form Designer generated code
section containing a method:

private void InitializeComponent()

And in that method, you need to register the checkChanged event, like this:
this.chkMyCheck.CheckedChanged += new
System.EventHandler(this.chkMyCheck_CheckedChanged);

Hope that helps!
 
Back
Top