jeudi 17 mars 2022

Como ocultar un panel con un checkbox?

281 / 5,000 Resultados de traducción I have the following problem, what I want to do is that when pressing a checkbox a panel is visible. I always hide the panels with image buttons and it works, but this time I want to do it with a checkbox, but the page does nothing.

This is code:

My checkbox and the aspx.

<asp:CheckBox ID="checkbox"  runat="server"  AutoPostBack="True"  oncheckedchanged="Checkbox_CheckedChanged"

<div class="col-sm-5">
        <asp:Panel ID="panel" runat="server" Visible="false">
            <asp:UpdatePanel ID="upanel" runat="server" UpdateMode="Conditional" >

            </asp:UpdatePanel>
        </asp:Panel>
    </div>

Server side C#

    protected void Checkbox_CheckedChanged(object sender, EventArgs e)
    {

        if (checkbox.Checked)
        {
            panel.Visible = true;
        }
        else
        {
            panel.Visible = false;
        }



Aucun commentaire:

Enregistrer un commentaire