Skip to content

Instantly share code, notes, and snippets.

@dcs619
Created March 14, 2013 20:46
Show Gist options
  • Select an option

  • Save dcs619/5165075 to your computer and use it in GitHub Desktop.

Select an option

Save dcs619/5165075 to your computer and use it in GitHub Desktop.
Alternative to building string confirmation message
<!-- Standard HTML -->
h3 class="header-text" >Confirm your Contribution: </h3>
<p>
<b>John Doe</b>, you're about to give <b>$400.00</b> to the <b>General Fund</b> and <b>$50.00</b> to the <b>Building Fund</b>.
Your total gift of <b>$450.00</b> will be given using a <b>Visa</b> credit card ending in <b>3456</b>.
</p>
@dcs619

dcs619 commented Mar 14, 2013

Copy link
Copy Markdown
Author

//Coded using string.format

    /// <summary>
    /// Handles the Click event of the btnSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
    protected void btnNext_Click( object sender, EventArgs e )
    {

        string msgCnfirmation = string.Format(@"<b>{0}</b>, you're about to give <b>${1}</b> to the 
            <b>{2}</b>. and <b>$50.00</b> to the <b>{3}</b>."
            , txtFirstName.Value + ' ' + txtLastName.Value, txtFund1.Value, txtAmount1.Value, txtFund2.Value, txtAmount2.Value);

        msgCnfirmation += string.Format(@"<br>Your total gift of <b>${0}</b> will be given using 
            a <b>{1}</b> credit card ending in <b>{2}</b>.", totalAmount.Value, txtCardNick.Value, txtCardNumber.Value);

        txtConfirmation.InnerText = msgCnfirmation;

        pnlDetails.Visible = false;
        pnlConfirm.Visible = true;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment