Solved

C# Fill HTML Input Text Box with value

Posted on 2011-03-08
1
952 Views
Last Modified: 2012-05-11
Hi Everyone,

Hopefullly someone can help. I've been trying to do this all day !

I have an online invoice system. Customer clicks on their invoice, and if it hasn't been paid yet it goes to a payment page.

It gives quick summary of the invoice and the amount and then customer clicks a pay now button and it goes through to paypal for the customer to pay online.

However, i cant get the amounts to pass through.

*************************************************************************************************

pay.aspx?number=xxxxxx   (Invoice Number)
_____________________________________


 <input type="hidden" name="cmd" value="_xclick" />
    <input type="hidden" name="business" value="pay@mysite.com" />
    <input type="hidden" name="currency_code" value="GBP" />
    <input type="hidden" name="return" value="returnhere.aspx" />
    <input type="hidden" name="no_note" value="1" />
    <input type="hidden" name="amount">
   <input type="hidden" name="item_name">

    Invoice Number:
    <asp:Label ID="LblInvoiceNumber" runat="server" Text="Label"></asp:Label>
        <br />
    Total Amount:  
    <br /><br />
        <asp:Button ID="PayNow" runat="server" Text="PAY NOW!" CausesValidation="False"
            PostBackUrl="https://www.paypal.com/cgi-bin/webscr" />

*************************************************************************************************

I want to fill 2 of the fields using a database connection.

The amount field and the item_name field.

Item_Name will need to be the invoice number, the amount will need to be the invoice amount.


Database fields.

Item_Name comes from InvoiceNumber
amount comes from InvoiceAmount

Any help would be greatly appreciated.

Many thanks!
0
Comment
Question by:jonpwatson5
1 Comment
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 35072295
If you change the definition of those two field to:
    <input type="hidden" name="amount" ID="amount" runat="server" />
   <input type="hidden" name="item_name" ID="item_name" runat="server" />

Open in new window

They will then get wrapped as Html server controls and you will be able to access the from code-behind using:
    amount.Value = "some value";
    item_name.Value = "some other value";

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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