Solved

C# Fill HTML Input Text Box with value

Posted on 2011-03-08
1
931 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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now