Link to home
Start Free TrialLog in
Avatar of Mr_Shaw
Mr_Shaw

asked on

checkbox not responding

I have a checkbox which I would like to use to show and hide other objects on the web page.

my code is


protected void altService_checkbox_CheckedChanged(object sender, EventArgs e)
    {
        #region show and hide alternative service lables and text boxes through the checkbox.
        if (altService_checkbox.Checked == true)
        {
            LearningPoints_Label.Visible = true;
        }
        else if (altService_checkbox.Checked == false)
        {
            LearningPoints_Label.Visible = false;
        }
        #endregion
}

When I check the checkbox nothing happens.

I am using c# and asp.net

can anybody help

thanks
ASKER CERTIFIED SOLUTION
Avatar of carlnorrbom
carlnorrbom
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Forgot to say it's the AutoPostBack property of the CheckBox, you can set it either declaratively:

<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true"/>

Or in code behind:

CheckBox1.AutoPostBack = true;

/Carl.
Avatar of Mr_Shaw
Mr_Shaw

ASKER

Nothing...my man nipple has more functionality
Avatar of Pratima
have you done any settings for  LearningPoints_Label.Visible  on Page_load

id yes then add it under Ispostback = false condition
Avatar of Mr_Shaw

ASKER

thanks... it was a postback issue