Solved

2 Clicks Rather Than One Refresh Calculation Correctly. ASP.NET/C#

Posted on 2008-10-16
2
376 Views
Last Modified: 2013-12-17
Hi,

I'm having an issue with Posting a form, calculating a discount and then presenting the right discount value. the values do seem to calculate, its just the discount that seems to not want to play properly.

if you click calculate on this page:

http://press.houseoffraser.co.uk/HofbiWeb/Default.aspx

you will see what i mean. (use 1000 and quantity of 1, then 10 on the 2nd click.)

for me, this is simple in classic ASP. but in asp.net it appears to cache that one value.


<%@ Page Language="C#" AutoEventWireup="true" Debug="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableViewState="False" EnableViewStateMac="False" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<style type="text/css">
label {width: 150px; }
div.field {width: 150px;}
 
.frmHeading { width: 40%; float: left; color: #999999; font-size: 135%; padding-bottom: 10px;}
.frmTextfield { width: 60%; float: left; padding-bottom: 10px;}
h4.normal { padding: 0px; }
#frmTitle { width: 100%; float: left; padding: 0px;}
#frmInstruction { width: 100%; text-align:right; float: right; padding: 0px; color: #999999; font-size: 120%; padding-right: 50px; padding-bottom:10px;}
.cardDesign { font-size: 80%; background-color:#ffffff; color:#666666; }
td { font-size: 90%; padding-top: 10px; }
th { font-size: 90%; padding-top: 20px;}
.padding{ padding-top: 9px; padding-bottom: 9px; }
#Den1, #Label1, #Label2, #Label3, #Label4, #Label5, #Label6, #Label7, #Label8 { font-size: 14pt;}
 
#ValidationSummary1 { font-size: 120%; z-index: 100 !important; position:relative; padding-bottom: 20px;}
 
</style>
    <title>Untitled Page</title>
    <link rel="stylesheet" href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/pt_corporate_businessincentives.css" type="text/css" media="screen" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/default.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/s7ir-screen.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/smoothbox.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/voucherCheckout.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/jsStyles.css" type="text/css" rel="stylesheet" />
	<link rel="stylesheet" href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/-/internal/css/pagemarker.css" type="text/css" />
</head>
<body id="ptCorporateBusinessIncentives">
    <form id="form1" runat="server">
    <div id="bi_contentasset">
 
      <h3>PLACE YOUR ORDER </h3><br clear="all" />
      <h4>Card Types</h4>
      <p>[IMAGES OF ALL HERE WITH LABELS - LABELS CONFIRMED BY CLARE]</p>
  <p>Corporate Black | Corporate Pink | Christmas </p>
  <div class="bi_contactform">
<div class="section type01a" id="ptContact">
	<div class="sectionInner">
	<div style="z-index: 100 !important; position:relative;"><h4>your order </h4></div>
	<div class="subSection">
		<div class="subSectionInner clearfix">
 
			<div id="frmTitle"><h4 class="normal">Your personal details</h4></div>
			<div>
				<div id="frmInstruction">
				<em>* Indicates a required field
				</em></div>
			</div>
					<div> 
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                    DisplayMode="List" />
             </div>
			<div class="frmHeading">
				<label for="dwfrm_contactUS_title"  class="required">Title:<em>*</em></label>
			</div>
			<div  class="frmTextfield">
				<select id="dwfrm_contactUS_title" class="" name="dwfrm_contactUS_title" enableviewstate="true" runat="server" >
				<option label="Please select" value="">Please select&nbsp; &nbsp;</option>
				<option label="Mr" value="Mr.">Mr</option>
				<option label="Miss" value="Miss">Miss</option>
				<option label="Mrs" value="Mrs.">Mrs</option>
				<option label="Ms" value="Ms.">Ms</option>
				<option label="Dr" value="Dr.">Dr</option>
				</select>&nbsp;
			    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="dwfrm_contactUS_title" 
                    ErrorMessage="Please select your title/salutation.">*</asp:RequiredFieldValidator>
			</div>
			<div class="frmHeading">
				<label for="dwfrm_contactUS_firstname"  class="required">
				First name:	<em>*</em>
				</label>
				</div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_firstname" class="text inputbox" type="text" name="dwfrm_contactUS_firstname" value=""  maxlength="2147483647" size="40" runat="server"/> <asp:RequiredFieldValidator 
                    ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="dwfrm_contactUS_firstname" 
                    ErrorMessage="Please enter your first name.">*</asp:RequiredFieldValidator>
&nbsp;</div>
		
			<div class="frmHeading">
				<label for="dwfrm_contactUS_lastname"  class="required">
				Last name*
				</label>
			</div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_lastname" class="text inputbox" type="text" name="dwfrm_contactUS_lastname" value=""  maxlength="2147483647" size="40" runat="server"/> <asp:RequiredFieldValidator 
                    ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="dwfrm_contactUS_lastname" 
                    ErrorMessage="Please enter your surname/last name.">*</asp:RequiredFieldValidator>
&nbsp;</div>
		
			<div class="frmHeading">
				<label for="dwfrm_contactUS_company"  class="required">
				Company<em>*</em>
				</label>
			</div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_company" class="text inputbox" type="text" name="dwfrm_contactUS_company" value=""  maxlength="2147483647" size="40" runat="server" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="dwfrm_contactUS_company" runat="server" 
                    ErrorMessage="Please enter the company you're ordering on behalf of.">*</asp:RequiredFieldValidator>
			</div>
		
			<div class="frmHeading">
				<label for="dwfrm_contactUS_emailadress"  class="required">
				Email address*</label></div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_emailadress" class="text inputbox" type="text" name="dwfrm_contactUS_emailadress" value=""  maxlength="100" size="40" runat="server" />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="dwfrm_contactUS_emailadress" 
                    ErrorMessage="Please enter a valid email address" 
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="dwfrm_contactUS_emailadress" 
                    ErrorMessage="Please enter an email address.">*</asp:RequiredFieldValidator>
			</div>
			<div class="frmHeading">
				<label for="dwfrm_contactUS_phone" >Daytime telephone number*</label></div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_phone" class="text inputbox" type="text" name="dwfrm_contactUS_phone" value=""  maxlength="2147483647" size="40" runat="server"/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                    ControlToValidate="dwfrm_contactUS_phone" 
                    ErrorMessage="Please enter your telephone number">*</asp:RequiredFieldValidator>
			</div>
			
						<div class="frmHeading">
				<label for="inAddressLine1" >Address 1</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine1" class="text inputbox" type="text" name="inAddressLine1" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
						<div class="frmHeading">
				<label for="inAddressLine2" >Address 2</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine2" class="text inputbox" type="text" name="inAddressLine2" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
						<div class="frmHeading">
				<label for="inAddressLine3" >Town</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine3" class="text inputbox" type="text" name="inAddressLine3" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
						<div class="frmHeading">
				<label for="inAddressLine4" >County</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine4" class="text inputbox" type="text" name="inAddressLine4" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
			<div class="frmHeading">
				<label for="inPostcode" >Postcode</label></div>
			<div class="frmTextfield">
				<input id="inPostcode" class="text inputbox" type="text" name="inPostcode" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
			
			<div id="paddingCell" style="padding-bottom: 40px;">
 
			</div>
			
		</div>
	</div>
	
	<!-- end first subsection -->
	<div class="subSection">
		<div class="subSectionInner clearfix">
		<h4>Order Details</h4>
			<div class="field required">
  <table style="width: 450px !important; margin-left: 3px;" border="0" cellspacing="0" cellpadding="5">
  	    <tr>
	        <td width="170" class="style2">Voucher Type </td>
	        <td colspan="2"><asp:RadioButton ID="inVouchEUR" runat="server" Text="EUR" AutoPostBack="True" GroupName="inVoucherDenomination" />
                <asp:RadioButton ID="inVouchGBP" runat="server" Text="GBP" Checked="true" AutoPostBack="True" GroupName="inVoucherDenomination" /></td>
	    </tr>
 
    <tr>
      <th scope="col" class="style2"><div align="left">Card Design </div></th>
      <th width="122" scope="col"><div align="left">Card Value </div></th>
      <th width="128" class="style1" scope="col"><div align="left">Quantity </div></th>
    </tr>
    <tr>
 
      <td class="style2"><div align="left">
        <select class="cardDesign" name="cardDesign1" enableviewstate="true" 
              id="cardDesign1" runat="server">
		  <option value=""> Choose Card Design &nbsp; </option>
          <option value="Classic Black">Classic Black</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
 
          <option value="Mens">Mens</option>
        </select>
          <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
              ControlToValidate="cardDesign1" 
              ErrorMessage="Please select a card design.">*</asp:RequiredFieldValidator>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Den1" runat="server" Text="£"></asp:Label>
          <input name="cardValue1" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue1" runat="server" enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator5" runat="server" 
                ControlToValidate="inCardValue1" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (1)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
 
      <td class="style1">
        
          <div align="left">
            <input name="cardQuantity1" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity1" runat="server" enableviewstate="False" />
          </div>
          </td>
    </tr>
    <tr>
      <td class="style2"><div align="left">
        <select class="cardDesign"  name="cardDesign2" enableviewstate="true" 
              id="cardDesign2" runat="server">
 
          <option value="Classic Black">Classic Black &nbsp;</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
        </select>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Label1" runat="server" Text="£"></asp:Label>
          <input name="textfield2" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue2" runat="server" atomicselection="true" 
                enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator2" runat="server" 
                ControlToValidate="inCardValue2" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (2)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
      <td class="style1">        
          <div align="left">
            <input name="textfield6" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity2" runat="server" enableviewstate="False" />
          </div>
          </td>
    </tr>
    <tr>
      <td class="style2"><div align="left">
        <select class="cardDesign"  name="cardDesign3" enableviewstate="true" 
              id="cardDesign3" runat="server">
 
          <option value="Classic Black">Classic Black &nbsp;</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
        </select>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Label2" runat="server" Text="£"></asp:Label>
          <input name="textfield3" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue3" runat="server" enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator6" runat="server" 
                ControlToValidate="inCardValue3" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (3)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
      <td class="style1"><label></label><label></label>
        
          <div align="left">
            <input name="textfield7" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity3" runat="server" enableviewstate="False" />
              </div></td>
    </tr>
    <tr>
      <td class="style2"><div align="left">
        <select class="cardDesign"  name="cardDesign4" enableviewstate="true" 
              id="cardDesign4" runat="server">
 
 
          <option value="Classic Black">Classic Black &nbsp;</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
        </select>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Label3" runat="server" Text="£"></asp:Label>
          <input name="inCardValue4" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue4" runat="server" enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator7" runat="server" 
                ControlToValidate="inCardValue4" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (4)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
      <td class="style1"><label></label>
        
          <div align="left">
            <input name="inCardQuantity4" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity4" runat="server" enableviewstate="False" />
          </div>
          </td>
    </tr>
 
    <!--tr>
      <td id="Td1">Postage &amp; Packaging </td>
 
      <td colspan="2">
          <asp:Label ID="Label4" runat="server" Text="£"></asp:Label>
          <input type="text" name="inPostage" value="0" maxlength="10" size="10" id="inPostage" readonly="readOnly" runat="server" /></td>
      
    </tr-->
    <tr>
      <td id="Td2">Line Total:</td>
      <td colspan="2">
          <asp:Label ID="Label5" runat="server" Text="£"></asp:Label>
          <input type="text" name="inLineTotal" value="0" size="10" id="inLineTotal" 
              readonly="readOnly" runat="server" enableviewstate="False" /></td>
    </tr>
 
    <tr>
      <td id="Td3">Total Discount: </td>
      <td colspan="2">
          <asp:Label ID="Label6" runat="server" Text="£"></asp:Label>
          <input type="text" name="inTotalDiscount" value="0" size="10" 
              id="inTotalDiscount" readonly="readOnly" runat="server" 
              enableviewstate="False" /> 
          @
          <asp:Label ID="inDiscountPc" runat="server" Text="0" EnableViewState="False"></asp:Label>%
                                            </td>
    </tr>
    <tr>
      <td id="Td4">Grand Total: </td>
 
      <td colspan="2">
          <asp:Label ID="Label7" runat="server" Text="£"></asp:Label>
          <input type="text" name="inGrandTotal" value="0" size="10" id="inGrandTotal" 
              readonly="readOnly" runat="server" enableviewstate="False" /></td>
    </tr>
    <tr>
      <td><br />
          <asp:Button ID="Button1" runat="server"  Text="Calculate" 
              CausesValidation="False" onclick="Button1_Click" EnableViewState="False" />
                                            </td>
    </tr>
	</table>
			</div>
		</div>
	</div>
<!-- end 2nd subsection -->
<!-- end 2nd subsection -->
	<div class="subSection">
		<div class="subSectionInner clearfix">
		<h4>Comments/Requests</h4>
				<textarea id="dwfrm_contactUS_message" class="" name="dwfrm_contactUS_message" rows="8" cols="60" runat="server"></textarea>
			</div><div style="padding-left: 15px; padding-bottom: 15px;"><input type="submit" name="submit" value="Submit Order" id="Submit2" onserverclick="Submit2_ServerClick" runat="server" /></div>
		</div>
		
	</div>
<!-- end 3rd subsection -->
			</div>
		</div>		
		</div>
	</div>
	</form>
</body>
</html>
 
<!--C# code-->
 
 
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            if (inVouchEUR.Checked)
            {
                Den1.Text = "¬";
                Label1.Text = "¬";
                Label2.Text = "¬";
                Label3.Text = "¬";
                Label4.Text = "¬";
                Label5.Text = "¬";
                Label6.Text = "¬";
                Label7.Text = "¬";
                //Label8.Text = "¬";
 
            }
            else {
                Den1.Text = "£";
                Label1.Text = "£";
                Label2.Text = "£";
                Label3.Text = "£";
                Label4.Text = "£";
                Label5.Text = "£";
                Label6.Text = "£";
                Label7.Text = "£";
                //Label8.Text = "£";
            }
 
            //System.Threading.Thread.Sleep(10000);
            int gTotal;
            decimal discountValue;
            discountValue = 0.0m;
            inTotalDiscount.Value = "0";
 
 
            if ((int.Parse(inLineTotal.Value) > 9999) && (int.Parse(inLineTotal.Value) < 14999))
            {
                discountValue = 7.5m;
            }
            if ((int.Parse(inLineTotal.Value) < 9999) && (int.Parse(inLineTotal.Value) > 4999))
            {
                discountValue = 5.0m;
            }
            if ((int.Parse(inLineTotal.Value) > 4999) && (int.Parse(inLineTotal.Value) < 999))
            {
                discountValue = 2.5m;
            }
            if (int.Parse(inLineTotal.Value) < 999)
            {
                discountValue = 0.0m;
            }
            if (int.Parse(inLineTotal.Value) > 14999)
            {
                discountValue = 10.0m;
            }
 
 
            gTotal = 0;
 
            gTotal = (int.Parse(inCardQuantity1.Value) * int.Parse(inCardValue1.Value)) +
                (int.Parse(inCardQuantity2.Value) * int.Parse(inCardValue2.Value)) +
                (int.Parse(inCardQuantity3.Value) * int.Parse(inCardValue3.Value)) +
                (int.Parse(inCardQuantity4.Value) * int.Parse(inCardValue4.Value));
 
 
            inGrandTotal.Value = Convert.ToDouble(gTotal - (gTotal * (discountValue / 100))).ToString();
 
            inLineTotal.Value = gTotal.ToString();
 
            inTotalDiscount.Value = Convert.ToDouble((gTotal * (discountValue / 100))).ToString();
 
            inDiscountPc.Text = discountValue.ToString();
 
 
        }
        
    }
    protected void Submit2_ServerClick(object sender, EventArgs e)
    {
 
 
 
        string strBody, denominationChar;
        strBody = "";
        denominationChar = "£";
        
strBody += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
strBody += "<html xmlns=\"http://www.w3.org/1999/xhtml\" >";
strBody += "<head>";
strBody += "    <title>Untitled Page</title>";
strBody += "	<style>";
strBody += "	* { font-family: \"Trebuchet MS\"}";
strBody += "	</style>";
strBody += "</head>";
strBody += "<body>";
strBody += " <h1>New Corporate Business Incentives Order";
strBody += "   (Email only)";
strBody += " </h1>";
strBody += "<h4 class=\"normal\">Customer Details</h4>";
strBody += "";
strBody += " <p>" + dwfrm_contactUS_title.Value + " "+ dwfrm_contactUS_firstname.Value + " "+ dwfrm_contactUS_lastname.Value+"</p>";
strBody += " <p>"+dwfrm_contactUS_company.Value+"</p>";
strBody += " <p><a href=\"mailto:"+ dwfrm_contactUS_emailadress.Value +"\">"+ dwfrm_contactUS_emailadress.Value +"</a> </p>";
strBody += " <p>"+dwfrm_contactUS_phone.Value+"</p>";
strBody += " <h4>Order Details</h4>";
 
if (inVouchEUR.Checked)
{
    denominationChar = "¬";
}
 
 
strBody += " <p>" + cardDesign1.Value +"@"+ denominationChar + inCardValue1.Value + " x " + inCardQuantity1.Value + "</p>";
 
strBody += " <p>" + cardDesign2.Value + "@" + denominationChar + inCardValue2.Value + " x " + inCardQuantity2.Value + "</p>";
 
strBody += " <p>" + cardDesign3.Value + "@" + denominationChar + inCardValue3.Value + " x " + inCardQuantity3.Value + "</p>";
 
strBody += " <p>" + cardDesign4.Value + "@" + denominationChar + inCardValue4.Value + " x " + inCardQuantity4.Value + "</p>";
 
strBody += "  <p>Postage: "+ denominationChar +inPostage.Value+"</p>";
strBody += "  <p>Line Total:"+ denominationChar+ inLineTotal.Value+"</p>";
strBody += "  <p>Total Discount:"+ denominationChar+ inTotalDiscount.Value+"</p>";
strBody += "  <p>Total value of order:"+ denominationChar+ inGrandTotal.Value+"</p>";
strBody += "  <p>COMMENTS:<br /><br />"+ dwfrm_contactUS_message.Value+"</p>";
strBody += " </body>";
strBody += " </html>";
        Response.Write(strBody);
 
        MailAddress To = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["manualCollectionRequiredEmail"]);
        MailAddress From = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["applicationEmail"]);
        MailMessage msgMail = new MailMessage(From, To);
 
        msgMail.Subject = "New Corporate Business Incentives Order";
        msgMail.IsBodyHtml = true;
 
        msgMail.Body = strBody;
        string server = System.Configuration.ConfigurationManager.AppSettings["emailServerIP"];
        SmtpClient client = new SmtpClient(server);
        client.Send(msgMail);
        Response.Redirect("Done.aspx");
 
    }
  /*  protected void Submit1_ServerClick(object sender, EventArgs e)
    {
 
    } */
 
    protected void Button1_Click(object sender, EventArgs e)
    {
 
 
 
    }
}

Open in new window

0
Comment
Question by:sattapaal
2 Comments
 
LVL 2

Accepted Solution

by:
EruditeMonkey earned 125 total points
ID: 22730311
It looks like the problem is with the order of the code. You lookup discountValue based on the value of inLineTotal.Value but the asignment of inLineTotal.Value comes after the set of if statements for discountValue.
The reordered version is below.

<%@ Page Language="C#" AutoEventWireup="true" Debug="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableViewState="False" EnableViewStateMac="False" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<style type="text/css">
label {width: 150px; }
div.field {width: 150px;}
 
.frmHeading { width: 40%; float: left; color: #999999; font-size: 135%; padding-bottom: 10px;}
.frmTextfield { width: 60%; float: left; padding-bottom: 10px;}
h4.normal { padding: 0px; }
#frmTitle { width: 100%; float: left; padding: 0px;}
#frmInstruction { width: 100%; text-align:right; float: right; padding: 0px; color: #999999; font-size: 120%; padding-right: 50px; padding-bottom:10px;}
.cardDesign { font-size: 80%; background-color:#ffffff; color:#666666; }
td { font-size: 90%; padding-top: 10px; }
th { font-size: 90%; padding-top: 20px;}
.padding{ padding-top: 9px; padding-bottom: 9px; }
#Den1, #Label1, #Label2, #Label3, #Label4, #Label5, #Label6, #Label7, #Label8 { font-size: 14pt;}
 
#ValidationSummary1 { font-size: 120%; z-index: 100 !important; position:relative; padding-bottom: 20px;}
 
</style>
    <title>Untitled Page</title>
    <link rel="stylesheet" href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/pt_corporate_businessincentives.css" type="text/css" media="screen" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/default.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/s7ir-screen.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/smoothbox.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/voucherCheckout.css" type="text/css" rel="stylesheet" />
    <link href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/default/v1223044820569/css/jsStyles.css" type="text/css" rel="stylesheet" />
	<link rel="stylesheet" href="http://demandware.edgesuite.net/aaba_dev/on/demandware.static/Sites-hof-Site/-/-/internal/css/pagemarker.css" type="text/css" />
</head>
<body id="ptCorporateBusinessIncentives">
    <form id="form1" runat="server">
    <div id="bi_contentasset">
 
      <h3>PLACE YOUR ORDER </h3><br clear="all" />
      <h4>Card Types</h4>
      <p>[IMAGES OF ALL HERE WITH LABELS - LABELS CONFIRMED BY CLARE]</p>
  <p>Corporate Black | Corporate Pink | Christmas </p>
  <div class="bi_contactform">
<div class="section type01a" id="ptContact">
	<div class="sectionInner">
	<div style="z-index: 100 !important; position:relative;"><h4>your order </h4></div>
	<div class="subSection">
		<div class="subSectionInner clearfix">
 
			<div id="frmTitle"><h4 class="normal">Your personal details</h4></div>
			<div>
				<div id="frmInstruction">
				<em>* Indicates a required field
				</em></div>
			</div>
					<div> 
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                    DisplayMode="List" />
             </div>
			<div class="frmHeading">
				<label for="dwfrm_contactUS_title"  class="required">Title:<em>*</em></label>
			</div>
			<div  class="frmTextfield">
				<select id="dwfrm_contactUS_title" class="" name="dwfrm_contactUS_title" enableviewstate="true" runat="server" >
				<option label="Please select" value="">Please select&nbsp; &nbsp;</option>
				<option label="Mr" value="Mr.">Mr</option>
				<option label="Miss" value="Miss">Miss</option>
				<option label="Mrs" value="Mrs.">Mrs</option>
				<option label="Ms" value="Ms.">Ms</option>
				<option label="Dr" value="Dr.">Dr</option>
				</select>&nbsp;
			    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="dwfrm_contactUS_title" 
                    ErrorMessage="Please select your title/salutation.">*</asp:RequiredFieldValidator>
			</div>
			<div class="frmHeading">
				<label for="dwfrm_contactUS_firstname"  class="required">
				First name:	<em>*</em>
				</label>
				</div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_firstname" class="text inputbox" type="text" name="dwfrm_contactUS_firstname" value=""  maxlength="2147483647" size="40" runat="server"/> <asp:RequiredFieldValidator 
                    ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="dwfrm_contactUS_firstname" 
                    ErrorMessage="Please enter your first name.">*</asp:RequiredFieldValidator>
&nbsp;</div>
		
			<div class="frmHeading">
				<label for="dwfrm_contactUS_lastname"  class="required">
				Last name*
				</label>
			</div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_lastname" class="text inputbox" type="text" name="dwfrm_contactUS_lastname" value=""  maxlength="2147483647" size="40" runat="server"/> <asp:RequiredFieldValidator 
                    ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="dwfrm_contactUS_lastname" 
                    ErrorMessage="Please enter your surname/last name.">*</asp:RequiredFieldValidator>
&nbsp;</div>
		
			<div class="frmHeading">
				<label for="dwfrm_contactUS_company"  class="required">
				Company<em>*</em>
				</label>
			</div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_company" class="text inputbox" type="text" name="dwfrm_contactUS_company" value=""  maxlength="2147483647" size="40" runat="server" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="dwfrm_contactUS_company" runat="server" 
                    ErrorMessage="Please enter the company you're ordering on behalf of.">*</asp:RequiredFieldValidator>
			</div>
		
			<div class="frmHeading">
				<label for="dwfrm_contactUS_emailadress"  class="required">
				Email address*</label></div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_emailadress" class="text inputbox" type="text" name="dwfrm_contactUS_emailadress" value=""  maxlength="100" size="40" runat="server" />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="dwfrm_contactUS_emailadress" 
                    ErrorMessage="Please enter a valid email address" 
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="dwfrm_contactUS_emailadress" 
                    ErrorMessage="Please enter an email address.">*</asp:RequiredFieldValidator>
			</div>
			<div class="frmHeading">
				<label for="dwfrm_contactUS_phone" >Daytime telephone number*</label></div>
			<div class="frmTextfield">
				<input id="dwfrm_contactUS_phone" class="text inputbox" type="text" name="dwfrm_contactUS_phone" value=""  maxlength="2147483647" size="40" runat="server"/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                    ControlToValidate="dwfrm_contactUS_phone" 
                    ErrorMessage="Please enter your telephone number">*</asp:RequiredFieldValidator>
			</div>
			
						<div class="frmHeading">
				<label for="inAddressLine1" >Address 1</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine1" class="text inputbox" type="text" name="inAddressLine1" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
						<div class="frmHeading">
				<label for="inAddressLine2" >Address 2</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine2" class="text inputbox" type="text" name="inAddressLine2" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
						<div class="frmHeading">
				<label for="inAddressLine3" >Town</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine3" class="text inputbox" type="text" name="inAddressLine3" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
						<div class="frmHeading">
				<label for="inAddressLine4" >County</label></div>
			<div class="frmTextfield">
				<input id="inAddressLine4" class="text inputbox" type="text" name="inAddressLine4" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
			<div class="frmHeading">
				<label for="inPostcode" >Postcode</label></div>
			<div class="frmTextfield">
				<input id="inPostcode" class="text inputbox" type="text" name="inPostcode" value=""  maxlength="2147483647" size="40" runat="server"/>
			</div>
			
			<div id="paddingCell" style="padding-bottom: 40px;">
 
			</div>
			
		</div>
	</div>
	
	<!-- end first subsection -->
	<div class="subSection">
		<div class="subSectionInner clearfix">
		<h4>Order Details</h4>
			<div class="field required">
  <table style="width: 450px !important; margin-left: 3px;" border="0" cellspacing="0" cellpadding="5">
  	    <tr>
	        <td width="170" class="style2">Voucher Type </td>
	        <td colspan="2"><asp:RadioButton ID="inVouchEUR" runat="server" Text="EUR" AutoPostBack="True" GroupName="inVoucherDenomination" />
                <asp:RadioButton ID="inVouchGBP" runat="server" Text="GBP" Checked="true" AutoPostBack="True" GroupName="inVoucherDenomination" /></td>
	    </tr>
 
    <tr>
      <th scope="col" class="style2"><div align="left">Card Design </div></th>
      <th width="122" scope="col"><div align="left">Card Value </div></th>
      <th width="128" class="style1" scope="col"><div align="left">Quantity </div></th>
    </tr>
    <tr>
 
      <td class="style2"><div align="left">
        <select class="cardDesign" name="cardDesign1" enableviewstate="true" 
              id="cardDesign1" runat="server">
		  <option value=""> Choose Card Design &nbsp; </option>
          <option value="Classic Black">Classic Black</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
 
          <option value="Mens">Mens</option>
        </select>
          <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
              ControlToValidate="cardDesign1" 
              ErrorMessage="Please select a card design.">*</asp:RequiredFieldValidator>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Den1" runat="server" Text="£"></asp:Label>
          <input name="cardValue1" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue1" runat="server" enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator5" runat="server" 
                ControlToValidate="inCardValue1" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (1)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
 
      <td class="style1">
        
          <div align="left">
            <input name="cardQuantity1" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity1" runat="server" enableviewstate="False" />
          </div>
          </td>
    </tr>
    <tr>
      <td class="style2"><div align="left">
        <select class="cardDesign"  name="cardDesign2" enableviewstate="true" 
              id="cardDesign2" runat="server">
 
          <option value="Classic Black">Classic Black &nbsp;</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
        </select>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Label1" runat="server" Text="£"></asp:Label>
          <input name="textfield2" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue2" runat="server" atomicselection="true" 
                enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator2" runat="server" 
                ControlToValidate="inCardValue2" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (2)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
      <td class="style1">        
          <div align="left">
            <input name="textfield6" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity2" runat="server" enableviewstate="False" />
          </div>
          </td>
    </tr>
    <tr>
      <td class="style2"><div align="left">
        <select class="cardDesign"  name="cardDesign3" enableviewstate="true" 
              id="cardDesign3" runat="server">
 
          <option value="Classic Black">Classic Black &nbsp;</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
        </select>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Label2" runat="server" Text="£"></asp:Label>
          <input name="textfield3" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue3" runat="server" enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator6" runat="server" 
                ControlToValidate="inCardValue3" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (3)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
      <td class="style1"><label></label><label></label>
        
          <div align="left">
            <input name="textfield7" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity3" runat="server" enableviewstate="False" />
              </div></td>
    </tr>
    <tr>
      <td class="style2"><div align="left">
        <select class="cardDesign"  name="cardDesign4" enableviewstate="true" 
              id="cardDesign4" runat="server">
 
 
          <option value="Classic Black">Classic Black &nbsp;</option>
          <option value="Classic Pink">Classic Pink</option>
          <option value="Womens 1">Womens 1</option>
          <option value="Womens 2">Womens 2</option>
          <option value="Seasonal">Seasonal</option>
        </select>
      </div></td>
      <td>
        <div align="left">
            <asp:Label ID="Label3" runat="server" Text="£"></asp:Label>
          <input name="inCardValue4" type="text" value="0" size="4" maxlength="4" 
                id="inCardValue4" runat="server" enableviewstate="False" />
            <asp:RangeValidator ID="RangeValidator7" runat="server" 
                ControlToValidate="inCardValue4" 
                ErrorMessage="Unfortunately, each card can only have a maximum load of 5000 GBP/EUR. (4)" 
                MaximumValue="5000" MinimumValue="0">*</asp:RangeValidator>
&nbsp;x</div></td>
      <td class="style1"><label></label>
        
          <div align="left">
            <input name="inCardQuantity4" type="text" value="0" size="4" maxlength="4" 
                  id="inCardQuantity4" runat="server" enableviewstate="False" />
          </div>
          </td>
    </tr>
 
    <!--tr>
      <td id="Td1">Postage &amp; Packaging </td>
 
      <td colspan="2">
          <asp:Label ID="Label4" runat="server" Text="£"></asp:Label>
          <input type="text" name="inPostage" value="0" maxlength="10" size="10" id="inPostage" readonly="readOnly" runat="server" /></td>
      
    </tr-->
    <tr>
      <td id="Td2">Line Total:</td>
      <td colspan="2">
          <asp:Label ID="Label5" runat="server" Text="£"></asp:Label>
          <input type="text" name="inLineTotal" value="0" size="10" id="inLineTotal" 
              readonly="readOnly" runat="server" enableviewstate="False" /></td>
    </tr>
 
    <tr>
      <td id="Td3">Total Discount: </td>
      <td colspan="2">
          <asp:Label ID="Label6" runat="server" Text="£"></asp:Label>
          <input type="text" name="inTotalDiscount" value="0" size="10" 
              id="inTotalDiscount" readonly="readOnly" runat="server" 
              enableviewstate="False" /> 
          @
          <asp:Label ID="inDiscountPc" runat="server" Text="0" EnableViewState="False"></asp:Label>%
                                            </td>
    </tr>
    <tr>
      <td id="Td4">Grand Total: </td>
 
      <td colspan="2">
          <asp:Label ID="Label7" runat="server" Text="£"></asp:Label>
          <input type="text" name="inGrandTotal" value="0" size="10" id="inGrandTotal" 
              readonly="readOnly" runat="server" enableviewstate="False" /></td>
    </tr>
    <tr>
      <td><br />
          <asp:Button ID="Button1" runat="server"  Text="Calculate" 
              CausesValidation="False" onclick="Button1_Click" EnableViewState="False" />
                                            </td>
    </tr>
	</table>
			</div>
		</div>
	</div>
<!-- end 2nd subsection -->
<!-- end 2nd subsection -->
	<div class="subSection">
		<div class="subSectionInner clearfix">
		<h4>Comments/Requests</h4>
				<textarea id="dwfrm_contactUS_message" class="" name="dwfrm_contactUS_message" rows="8" cols="60" runat="server"></textarea>
			</div><div style="padding-left: 15px; padding-bottom: 15px;"><input type="submit" name="submit" value="Submit Order" id="Submit2" onserverclick="Submit2_ServerClick" runat="server" /></div>
		</div>
		
	</div>
<!-- end 3rd subsection -->
			</div>
		</div>		
		</div>
	</div>
	</form>
</body>
</html>
 
<!--C# code-->
 
 
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            if (inVouchEUR.Checked)
            {
                Den1.Text = "¬";
                Label1.Text = "¬";
                Label2.Text = "¬";
                Label3.Text = "¬";
                Label4.Text = "¬";
                Label5.Text = "¬";
                Label6.Text = "¬";
                Label7.Text = "¬";
                //Label8.Text = "¬";
 
            }
            else {
                Den1.Text = "£";
                Label1.Text = "£";
                Label2.Text = "£";
                Label3.Text = "£";
                Label4.Text = "£";
                Label5.Text = "£";
                Label6.Text = "£";
                Label7.Text = "£";
                //Label8.Text = "£";
            }
 
            //System.Threading.Thread.Sleep(10000);
            int gTotal;
            decimal discountValue;
            discountValue = 0.0m;
            inTotalDiscount.Value = "0";
 
 	gTotal = 0;
 
            gTotal = (int.Parse(inCardQuantity1.Value) * int.Parse(inCardValue1.Value)) +
                (int.Parse(inCardQuantity2.Value) * int.Parse(inCardValue2.Value)) +
                (int.Parse(inCardQuantity3.Value) * int.Parse(inCardValue3.Value)) +
                (int.Parse(inCardQuantity4.Value) * int.Parse(inCardValue4.Value)); 
	
	 inLineTotal.Value = gTotal.ToString();
 
            if ((int.Parse(inLineTotal.Value) > 9999) && (int.Parse(inLineTotal.Value) < 14999))
            {
                discountValue = 7.5m;
            }
            if ((int.Parse(inLineTotal.Value) < 9999) && (int.Parse(inLineTotal.Value) > 4999))
            {
                discountValue = 5.0m;
            }
            if ((int.Parse(inLineTotal.Value) > 4999) && (int.Parse(inLineTotal.Value) < 999))
            {
                discountValue = 2.5m;
            }
            if (int.Parse(inLineTotal.Value) < 999)
            {
                discountValue = 0.0m;
            }
            if (int.Parse(inLineTotal.Value) > 14999)
            {
                discountValue = 10.0m;
            }
 
 
           
  
            inGrandTotal.Value = Convert.ToDouble(gTotal - (gTotal * (discountValue / 100))).ToString();
 
 
            inTotalDiscount.Value = Convert.ToDouble((gTotal * (discountValue / 100))).ToString();
 
            inDiscountPc.Text = discountValue.ToString();
 
 
        }
        
    }
    protected void Submit2_ServerClick(object sender, EventArgs e)
    {
 
 
 
        string strBody, denominationChar;
        strBody = "";
        denominationChar = "£";
        
strBody += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
strBody += "<html xmlns=\"http://www.w3.org/1999/xhtml\" >";
strBody += "<head>";
strBody += "    <title>Untitled Page</title>";
strBody += "	<style>";
strBody += "	* { font-family: \"Trebuchet MS\"}";
strBody += "	</style>";
strBody += "</head>";
strBody += "<body>";
strBody += " <h1>New Corporate Business Incentives Order";
strBody += "   (Email only)";
strBody += " </h1>";
strBody += "<h4 class=\"normal\">Customer Details</h4>";
strBody += "";
strBody += " <p>" + dwfrm_contactUS_title.Value + " "+ dwfrm_contactUS_firstname.Value + " "+ dwfrm_contactUS_lastname.Value+"</p>";
strBody += " <p>"+dwfrm_contactUS_company.Value+"</p>";
strBody += " <p><a href=\"mailto:"+ dwfrm_contactUS_emailadress.Value +"\">"+ dwfrm_contactUS_emailadress.Value +"</a> </p>";
strBody += " <p>"+dwfrm_contactUS_phone.Value+"</p>";
strBody += " <h4>Order Details</h4>";
 
if (inVouchEUR.Checked)
{
    denominationChar = "¬";
}
 
 
strBody += " <p>" + cardDesign1.Value +"@"+ denominationChar + inCardValue1.Value + " x " + inCardQuantity1.Value + "</p>";
 
strBody += " <p>" + cardDesign2.Value + "@" + denominationChar + inCardValue2.Value + " x " + inCardQuantity2.Value + "</p>";
 
strBody += " <p>" + cardDesign3.Value + "@" + denominationChar + inCardValue3.Value + " x " + inCardQuantity3.Value + "</p>";
 
strBody += " <p>" + cardDesign4.Value + "@" + denominationChar + inCardValue4.Value + " x " + inCardQuantity4.Value + "</p>";
 
strBody += "  <p>Postage: "+ denominationChar +inPostage.Value+"</p>";
strBody += "  <p>Line Total:"+ denominationChar+ inLineTotal.Value+"</p>";
strBody += "  <p>Total Discount:"+ denominationChar+ inTotalDiscount.Value+"</p>";
strBody += "  <p>Total value of order:"+ denominationChar+ inGrandTotal.Value+"</p>";
strBody += "  <p>COMMENTS:<br /><br />"+ dwfrm_contactUS_message.Value+"</p>";
strBody += " </body>";
strBody += " </html>";
        Response.Write(strBody);
 
        MailAddress To = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["manualCollectionRequiredEmail"]);
        MailAddress From = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["applicationEmail"]);
        MailMessage msgMail = new MailMessage(From, To);
 
        msgMail.Subject = "New Corporate Business Incentives Order";
        msgMail.IsBodyHtml = true;
 
        msgMail.Body = strBody;
        string server = System.Configuration.ConfigurationManager.AppSettings["emailServerIP"];
        SmtpClient client = new SmtpClient(server);
        client.Send(msgMail);
        Response.Redirect("Done.aspx");
 
    }
  /*  protected void Submit1_ServerClick(object sender, EventArgs e)
    {
 
    } */
 
    protected void Button1_Click(object sender, EventArgs e)
    {
 
 
 
    }
}

Open in new window

0
 

Author Closing Comment

by:sattapaal
ID: 31506683
cheers, cant believe my logic sometimes.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question