TBogdan
TBogdan

Reputation: 737

Checkbox evenhandler for Checked Changed event dosen't trigger when checked state is modified

The CheckBox dosen't trigger oncheckedchanged event:

<asp:CheckBox ID="ccCritica" runat="server" 
                                style="z-index: 1; right: 15px; top: 100px; position: absolute" 
                                oncheckedchanged="ccCritica_CheckedChanged" />

.

protected void ccCritica_CheckedChanged(object sender, EventArgs e)
{
    if(ccCritica.Checked == true)
    {
        ddSarcinaDep.Enabled = true;
    }
}

I've tried with debug and it dosen't call the eventhandler.I'm using Visual Studio 2010 professional, and I'm Developing an ASP.NET Web application.Thanks

Upvotes: 1

Views: 17074

Answers (2)

Amiram Korach
Amiram Korach

Reputation: 13286

Set AutoPostBack="true" in aspx

Upvotes: 8

NG.
NG.

Reputation: 6043

Use the following code:

<asp:CheckBox ID="ccCritica" runat="server" style="z-index: 1; right: 15px; top: 100px; position: absolute" AutoPostBack="true"
                            oncheckedchanged="ccCritica_CheckedChanged" />

    protected void ccCritica_CheckedChanged(object sender, EventArgs e)
    {
        if (ccCritica.Checked == true)
        {

            ccCritica.Enabled = true;
        }
    }

Upvotes: 0

Related Questions