xarzu
xarzu

Reputation: 9479

How do you hide a field set?

fsCreditCard.Visible = false;

works in some of the code-behind c# code to hide the fieldset, fsCreditCard, defined in .aspx code like this:

<fieldset id="fsCreditCard" runat="server" visible="false">
    <legend>Credit Card</legend>
        <ul style="margin:50px;font-size:16px;">
            <li>
                <u><b><a href="javascript:OpenPaymentWindow(); fsCreditCard.Visible= false; fsAfterCreditCard.Visible = true; fsPaymentOptions.Visible=false;">Click here</a></b></u> now to open the PayPal payment window and complete your payment. If you have any trouble, please make sure any pop up blockers are disabled and reload this page.<br /><br />
            </li>
        </ul>
</fieldset>

Now, when the user clicks on the hyperlink "Click Here", the "OpenPaymentWindow actually is processed but the "fsCreditCard.Visible= false; fsAfterCreditCard.Visible = true;" commands are not done. They do not seem to be javascript commands and they exist elsewhere in C# code. What do you suggest?

Upvotes: 1

Views: 2212

Answers (1)

Karl Anderson
Karl Anderson

Reputation: 34846

Move the logic to show/hide elements into the OpenPaymentWindow JavaScript function and use jQuery selectors, like this:

function OpenPaymentWindow() {
    // Logic to open payment window here

    // Show/hide DOM elements here
    $('#fsCreditCard').hide();
    $('#fsAfterCreditCard').show();
    $('#fsPaymentOptions').hide();
}

Upvotes: 1

Related Questions