Bruce Gust
asked on
Introducing a Paypal form in a C# document
My code is attached.
Towards the bottom of the page, there's a series of input fields that are being sent to paypal (search for Aggregated items). I'm attempting to put the field that's carrying the total amount in the form and I get this message:
Towards the bottom of the page, there's a series of input fields that are being sent to paypal (search for Aggregated items). I'm attempting to put the field that's carrying the total amount in the form and I get this message:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="invoice.aspx.cs" Inherits="Invoice" %>
<!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 runat="server">
<title>Quality Assurance Invoice</title>
<LINK href="style1.css" type="text/css" rel="stylesheet">
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Verdana; text-align:center">
<asp:Button ID="btnDone" runat="server" Text="Done" OnClick="btnDone_Click" /><br />
<asp:Label ID="lblMsg" runat="server" ForeColor="Red"></asp:Label></div>
<div style="text-align:right; font-family:Verdana">
<img src="images/qmslogo.jpg" alt="qmslogo" />
<font size="+2"><b>Quality Assurance INVOICE</b></font><br />
INVOICE #:
<asp:Label ID="lblInvoiceNum" runat="server"></asp:Label><br />
Date: <asp:Label ID="lblDateCompleted" runat="server"></asp:Label><br />
Tax ID: <asp:Label ID="lblTaxId" runat="server"></asp:Label><br />
<asp:Label ID="lblEmailTo" runat="server"></asp:Label>
</div>
<div style="text-align:left; font-family:Verdana">
<span style="font-size: 11pt">
<b>Bill To:</b><br />
</span>
<div style="padding-left:0.5in; padding-top:5px">
<asp:Label ID="lblCompanyName" runat="server"></asp:Label><br />
<asp:Label ID="lblCompanyContact" runat="server"></asp:Label><br />
<asp:Label ID="lblCompanyAddr" runat="server"></asp:Label><span style="font-size: 11pt">
<br />
</span>
<br />
<table style="font-family:Verdana" width="80%" align="center">
<tr>
<td width="33%" align="center">
QC CONTROL NO.<br />
<asp:Label ID="lblQmsCtrlNum" runat="server" Font-Bold="True"></asp:Label></td>
<td width="33%" align="center">
Period Funded<br />
<asp:Label ID="lblPeriodFunded" runat="server" Font-Bold="True"></asp:Label></td>
<td width="34%" align="center">
Terms<br />
<i><b>Due on receipt</b></i>
</td>
</tr>
</table>
<br />
</div>
</div>
<div style="font-family:Verdana; text-align:center">
<asp:Label ID="Label4" runat="server" Text="Quality Control Reviews" Font-Names="Verdana" Font-Bold="True" Font-Size="Large"></asp:Label>
<asp:GridView ID="gvBilling" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="90%" OnRowDataBound="gvBilling_RowDataBound" Font-Size="Small">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<Columns>
<asp:TemplateField HeaderText="Count">
<ItemTemplate>
<asp:Label ID="lblRowNum" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="loan_number" HeaderText="Case #" />
<asp:BoundField DataField="first_name" HeaderText="First Name" />
<asp:BoundField DataField="last_name" HeaderText="Last Name" /><asp:BoundField DataField="cost" HeaderText="Cost" DataFormatString="{0:c}" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Right" />
<HeaderStyle HorizontalAlign="Right" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="White" ForeColor="#003399" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
</asp:GridView>
<div align=right>
<asp:Label
ID="lblTotalWord1" runat="server" Text="Total" Font-Bold="True" Font-Size="Large"></asp:Label>
<asp:Label ID="lblTotalDue" runat="server" Text="$0.00"></asp:Label>
</div>
<asp:Label ID="Label5" runat="server" Text="Early Payment Default Audit" Font-Bold="True" Font-Size="Large"></asp:Label><br />
<asp:GridView ID="gvEPD" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="90%" OnRowDataBound="gvBilling_RowDataBound" Font-Size="Small">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<Columns>
<asp:TemplateField HeaderText="Count">
<ItemTemplate>
<asp:Label ID="lblRowNum" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="loan_number" HeaderText="Case #" />
<asp:BoundField DataField="first_name" HeaderText="First Name" />
<asp:BoundField DataField="last_name" HeaderText="Last Name" />
<asp:BoundField DataField="Early_Payment_Default" HeaderText="EPD" SortExpression="Early_Payment_Default" />
<asp:BoundField DataField="cost" HeaderText="Cost" DataFormatString="{0:c}" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Right" />
<HeaderStyle HorizontalAlign="Right" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="White" ForeColor="#003399" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
</asp:GridView>
<div align=right><asp:Label ID="Label1"
runat="server" Text="Total" Font-Bold="True" Font-Size="Large"></asp:Label>
<asp:Label ID="lblTotal2" runat="server" Text="$0.00"></asp:Label>
</div>
<asp:Label ID="Label6" runat="server" Text="Denial/Withdrawn" Font-Bold="True" Font-Size="Large"></asp:Label><br />
<asp:GridView ID="gvDenied" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="90%" OnRowDataBound="gvBilling_RowDataBound" Font-Size="Small">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<Columns>
<asp:TemplateField HeaderText="Count">
<ItemTemplate>
<asp:Label ID="lblRowNum" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="loan_number" HeaderText="Case #" />
<asp:BoundField DataField="first_name" HeaderText="First Name" />
<asp:BoundField DataField="last_name" HeaderText="Last Name" />
<asp:BoundField DataField="loan_denied" HeaderText="Denied" HtmlEncode="False" /><asp:BoundField DataField="cost" HeaderText="Cost" DataFormatString="{0:c}" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Right" />
<HeaderStyle HorizontalAlign="Right" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="White" ForeColor="#003399" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
</asp:GridView>
<div align=right>
<!- here's your total ->
<asp:Label ID="Label2"
runat="server" Text="Total" Font-Bold="True" Font-Size="Large"></asp:Label>
<asp:Label ID="lblTotal3" runat="server" Text="$0.00"></asp:Label>
</div>
<asp:Label ID="Label7" runat="server" Text="Field Review Appraisal" Font-Bold="True" Font-Size="Large"></asp:Label><br />
<asp:GridView ID="gvFRA" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="90%" OnRowDataBound="gvBilling_RowDataBound" Font-Size="Small">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<Columns>
<asp:TemplateField HeaderText="Count">
<ItemTemplate>
<asp:Label ID="lblRowNum" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="loan_number" HeaderText="Case #" />
<asp:BoundField DataField="first_name" HeaderText="First Name" />
<asp:BoundField DataField="last_name" HeaderText="Last Name" />
<asp:BoundField DataField="Field_Review" HeaderText="FRA" SortExpression="FRA" />
<asp:BoundField DataField="cost" HeaderText="Cost" DataFormatString="{0:c}" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Right" />
<HeaderStyle HorizontalAlign="Right" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="White" ForeColor="#003399" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
</asp:GridView>
<div align=right><asp:Label
ID="Label3" runat="server" Text="Total" Font-Bold="True" Font-Size="Large"></asp:Label>
<asp:Label ID="lblTotal4" runat="server" Text="$0.00"></asp:Label>
</div>
<table id="FRATotals" width="90%" align="center" cellpadding="5">
<tr>
<td width="10%"> </td>
<td width="10%"> </td>
<td width="10%"> </td>
<td width="10%"> </td>
<td width="*%" align="right">
LATE CHARGES</td>
<td width="20%" align="right">
<asp:Label ID="lblOtrCharges" runat="server">$0.00</asp:Label></td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%"> </td>
<td width="10%"> </td>
<td width="10%"> </td>
<td width="*%" align="right">
OTHER CHARGES</td>
<td width="20%" align="right">
<asp:Label ID="lblOtherCharges" runat="server">$0.00</asp:Label>
</td>
</tr>
<tr>
<td colspan="5" align="right">SHREDDING/SHIPPING & HANDLING</td>
<td align="right">
<asp:Label ID="lblShipping" runat="server" Text="$0.00"></asp:Label></td>
</tr>
<tr>
<td colspan="5" align="right"><b>NET TOTAL</b></td>
<td align="right">
<!- here's my Paypal form ->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="bruce@brucegust.com">
<input type="hidden" name="item_name" value="Aggregated items">
<input type="hidden" name="amount" value="<asp:Label ID="lblGrandTotal" runat="server" Text="$0.00" Font-Bold="True" Font-Size="Large"></asp:Label>">
<input type="hidden" name="return" value="http://www.brucegust.com/ChapelThunder/Customer/Verify.asp">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="Images/TransactionComplete.jpg" border="0" name="submit"></form>
</td>
</tr>
</table>
</div>
<br /><br />
<div style="font-family:Verdana; text-align:left">
If you have any questions concerning this invoice, please contact Thomas F. Duncan at 615-591-2528 ext 22,
or email tduncan@qcmortgage.com. Make all checks payable to:<br />
<br />
<b>Quality Mortgage Services</b>.<br />
1111 Lakeview Drive, Franklin TN 37067<br /><br />
<font size="-1">Balances over 30 days will accrue a charge of 2% per month.</font>
</div>
</form>
</body>
</html>
Error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0117: 'System.Web.UI.HtmlControls.HtmlInputHidden' does not contain a definition for 'Text'
Source Error:
Line 605: //Double val4 = Convert.ToDouble(lblTotal4.Text);
Line 606: Double valTotal = Convert.ToDouble(total) + Convert.ToDouble(otherCharges) + Convert.ToDouble(shipping) + Convert.ToDouble(otrCharges);
Line 607: lblGrandTotal.Text = Convert.ToString(String.Format("{0:c}", valTotal));
Line 608: }
Line 609:
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
x_com...
I'm thinking we're on to something but the fact that I'm still very new to C#, I'm obviously missing something.
Where do I put "amount.Text = Convert.ToString(String.Fo rmat("{0:c }", valTotal));" There's another file called invoice.aspx.cs. Does it go there? Sorry for being so thick, but there it is.
I'm thinking we're on to something but the fact that I'm still very new to C#, I'm obviously missing something.
Where do I put "amount.Text = Convert.ToString(String.Fo
ASKER
After some additional playing around, I tried this:
This is a portion of the code on the invoice.aspx.cs file that appeared to be calculating the grand total. I put your cs code in it thinking this would be cake and ice cream. On trying it, I got the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0117: 'System.Web.UI.HtmlControl s.HtmlInpu tHidden' does not contain a definition for 'value'
Source Error:
Line 606: Double valTotal = Convert.ToDouble(total) + Convert.ToDouble(otherChar ges) + Convert.ToDouble(shipping) + Convert.ToDouble(otrCharge s);
Line 607: lblGrandTotal.Text = Convert.ToString(String.Fo rmat("{0:c }", valTotal));
Line 608: amount.value = Convert.ToString(String.Fo rmat("{0:c }", valTotal));
Line 609: }
Line 610:
Source File: c:\www\analyze\invoice.asp x.cs Line: 608
What am I doing wrong?
This is a portion of the code on the invoice.aspx.cs file that appeared to be calculating the grand total. I put your cs code in it thinking this would be cake and ice cream. On trying it, I got the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0117: 'System.Web.UI.HtmlControl
Source Error:
Line 606: Double valTotal = Convert.ToDouble(total) + Convert.ToDouble(otherChar
Line 607: lblGrandTotal.Text = Convert.ToString(String.Fo
Line 608: amount.value = Convert.ToString(String.Fo
Line 609: }
Line 610:
Source File: c:\www\analyze\invoice.asp
What am I doing wrong?
private void calculateGrandTotal()
{
//this.total = this.otherCharges + this.subtotal + this.shipping;
//lblGrandTotal.Text = total.ToString("c");
//Double val1 = Convert.ToDouble(lblTotalDue.Text);
//Double val2 = Convert.ToDouble(lblTotal2.Text);
//Double val3 = Convert.ToDouble(lblTotal3.Text);
//Double val4 = Convert.ToDouble(lblTotal4.Text);
Double valTotal = Convert.ToDouble(total) + Convert.ToDouble(otherCharges) + Convert.ToDouble(shipping) + Convert.ToDouble(otrCharges);
lblGrandTotal.Text = Convert.ToString(String.Format("{0:c}", valTotal));
amount.value = Convert.ToString(String.Format("{0:c}", valTotal));
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've noticed that you put the label control inside hidden's field? Try strip out the label control from the hidden field and set it as server control
eg:
aspx
============
<input type="hidden" name="amount" value="<asp:Label ID="lblGrandTotal" runat="server" Text="$0.00" Font-Bold="True" Font-Size="Large"></asp:La
Should be
<input type="hidden" name="amount" value="$0.00" id="amount" runat="server">
c#
======
amount.Text = Convert.ToString(String.Fo