[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

OnCheckChanged event not firing.

Posted on 2009-04-20
3
Medium Priority
?
800 Views
Last Modified: 2012-05-06
Hi,

Not sure exactly what is wrong, but I can't seem to get the "OnCheckChanged" event to fire when clicking on a checkbox or a radiobutton.  I was having this trouble is a current website I was working on, so I decided to make a whole new website with nothing on it except for a checkbox and a radiobutton to test.  The new website didn't work either.  Attached is the complete code.  Maybe you guys could see something I've missed
/***** Web Form *****/
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButton ID="RadioButton1" runat="server" Text="Radio1" 
            OnCheckedChanged="RadioButton1_CheckedChanged" />
        <br />
        <br />
        <asp:CheckBox ID="CheckBox1" runat="server" Text="Check1" 
            OnCheckedChanged="CheckBox1_CheckedChanged" />    
        <br />
        <br />
        <asp:Label ID="Label1" runat="server" ForeColor="Red" Font-Bold="true" />
    </div>
    </form>
</body>
</html>
 
 
/***** Code Behind *****/
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
        Label1.Text = "Radio was clicked";
    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        Label1.Text = "Checkbox was clicked";
    }
}

Open in new window

0
Comment
Question by:P1ST0LPETE
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
abel earned 2000 total points
ID: 24190145
I don't see a button or something, should I assume that you expect the checkedChanged event to fire when clicking the checkbox? If so, you should set the AutoPostBack value for the checkbox and you will be fine.
0
 
LVL 10

Author Closing Comment

by:P1ST0LPETE
ID: 31572543
OMG, I am such a noob.  I forgot about the AutoPostBack property.
Thanks for the help.
0
 
LVL 39

Expert Comment

by:abel
ID: 24190562
> OMG, I am such a noob.  > Thanks for the help.
happens to all of us, sometimes you can just stare and stare and still not seeing it.... Glad I could be of help :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question