P1ST0LPETE
asked on
OnCheckChanged event not firing.
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
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";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> 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 :)
happens to all of us, sometimes you can just stare and stare and still not seeing it.... Glad I could be of help :)
ASKER
Thanks for the help.