1

I'm trying to hide a asp.net panel on click a button.

JavaScript and controls I used

<script type="text/javascript">
    function ShowPanel ()
    {
        document.getElementById("<%= pnlCombinedPdf.ClientID %>").style.display = "none"; 
    }
</script>

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ShowPanel()"/>

        <asp:Panel ID="pnlCombinedPdf" runat="server" Visible="false">
            <fieldset>
                <legend class="SubSectionHeading">Merge PDF</legend>
                <table style="width: 100%">
                    <tr>
                        <td>
                            <asp:Button ID="btnMergePdf" runat="server" Text="Merge PDF"/>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </asp:Panel>

But the problem is it does not show the panel after clicked the button. Please help me make it visible on click.

1
  • 1
    "I'm trying to hide a asp.net panel on click a button...the problem is it does not show the panel after clicked the button" - that's because you are hiding it when the buttons clicked. If it's some sort of toggle behaviour you are after just toggle the display property from none to block. Commented Feb 25, 2014 at 15:09

2 Answers 2

1

you just need to change your jquery code:

function ShowPanel ()
{
   document.getElementById("pnlCombinedPdf").style.display = 'none';
        return false;
}

that's all

Sign up to request clarification or add additional context in comments.

Comments

0

Use display = "block" to show and display = "none" to hide

function ShowPanel ()
{
    document.getElementById("<%= pnlCombinedPdf.ClientID %>")
            .style.display = "block"; 
}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.