Tring to pass variables to payflow pro. I found a script already written but how do I pass the variable from textbox? Where post.append is I need the value of my textbox's

<asp:TextBox ID="balanceTextBox" runat="server" Columns="20" Rows="4" 
                                Text='<% #Bind("cardacct")%>' ValidationGroup="add"></asp:TextBox>


using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (Request.IsAuthenticated)
            Label2.Text = "";

    protected void Search_Click(object sender, EventArgs e)
        string sqlCmd = "Select * From customer Where cust_no = '" + CustSearch + "'";

    protected void CustSearch_TextChanged(object sender, EventArgs e)
    protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e)


    protected void CCButton_Click(object sender, EventArgs e)

            //PayPal offers an SDK for .net that can be downloaded here: [url][/url]

            //this was created because the SDK can be somewhat confusing.

            //*************** Note ***********************

            //before using this code change the following line below: 


            //you need to change the ID to something beside 14 that will be unique

            //1. Set the url to send the transaction to


            string postURL = "";


            //string postURL = "";
            //2. Set your user info. This is case sensitive

            string PWD = "xxx";
            string USER = "xxx";
            string VENDOR = "xxx";
            string PARTNER = "xxx";

            //3. now create the name value pair string to send to the Payflow servers

            //more variables can be found in the docs that can be downloaded from your payflow manager

            StringBuilder postData = new StringBuilder();

            //***************add the user info***************

            postData.Append("PWD=" + PWD);
            postData.Append("&USER=" + USER);
            postData.Append("&PARTNER=" + PARTNER);
            postData.Append("&VENDOR=" + VENDOR);

            //***************add some required info for testing***************

            postData.Append("&CUSTIP=" + Request.UserHostAddress);

            //S for Sale. A for Auth. More in the docs

            // postData.Append("&AMT=1.00");
            GetDataItem(%# Eval("balance") %;

            //this is in the format MMYY

            postData.Append("&STREET=155515 Q St");
            //C is for credit card, P is for PayPal Express Checkout. More in the docs

            //*************add some optional feilds***************

            postData.Append("&COMMENT1=ASP.NET Testing");

            //make sure that the "@" is not url encoded or you will get an error


            //this is if you want to have PayPal send an IPN post

            //postData.Append("&NOTIFYURL=" + xxxx);

            //removed for now: INVNUM=12345678&

            //add the REQUEST_ID

            postData.Append("&REQUEST_ID=" + System.Guid.NewGuid().ToString());

            //write out the post data

             Response.Write("PostData:<br> " + postData + "<br><br>");

            byte[] requestBytes = Encoding.UTF8.GetBytes(postData.ToString());

            HttpWebRequest wrWebRequest = (HttpWebRequest)WebRequest.Create(postURL);

            //Set WebRequest Properties

            wrWebRequest.Method = "POST";

            wrWebRequest.Accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";

            wrWebRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060909 Firefox/";

            wrWebRequest.ContentType = "text/namevalue";

            wrWebRequest.ContentLength = requestBytes.Length;

            wrWebRequest.AllowAutoRedirect = false;

            //add the custom headers


            // write the form values into the request message

            Stream reqStream = wrWebRequest.GetRequestStream();

            reqStream.Write(requestBytes, 0, requestBytes.Length);

            // Get the response.

            HttpWebResponse hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();


            StreamReader responseReader = new StreamReader(wrWebRequest.GetResponse().GetResponseStream());

            string responseData = responseReader.ReadToEnd();
            //Response.Write("Response Data:<br>" + responseData);
            Label2.Text = ("Response Data:<br>" + responseData);

Then add the code to append your data also. You have the code to append data already in the scripts you provided (bad idea including a valid email though) and so, whats your actual question, you look like you posted your own answer

Forgot my email was in there.
Where it says postData.Append("&AMT=1.00");

I need that to post the info from my textbox so instead of $1.00 it needs to be "value from balancetextbox"

So, change it so it adds the text box contents.

Well thats my problem don't know the code to pass the textbox info

Do you know how to get the info out the text box?

Seems like i a having problems getting the data out cause the textbox is inside a datalist

<asp:FormView ID="FormView1" RunAt="server" DataKeyNames="cust_no" 
                        <td align="right">
                            <b>Product ID:</b></td>
                            <%# Eval("cust_no") %></td>
                        <td align="right">
                            <b>Product Name:</b></td>
                            <%# Eval("firstname") %></td>
                        <td align="right">
                            <b>Category ID:</b></td>
                            <%# Eval("lastname") %></td>
                        <td align="right">
                            <b>Quantity Per Unit:</b></td>
                            <%# Eval("balance") %></td>
                        <td align="right">
                            <b>Unit Price:</b></td>
                            <%# Eval("status") %></td>
                        <td align="right">
                            <b>Card Number</b></td>
                            <asp:TextBox ID="BalanceTextBox" runat="server" Columns="20" Rows="4" 
                                Text='<% #Bind("cardacct")%>' ValidationGroup="add"></asp:TextBox>
                        <td align="right">
                            <b>Exp Date:</b></td>
                            <asp:TextBox ID="ExpTextBox" runat="server" Columns="20" Rows="4" 
                                Text='<% #Bind("cardexp")%>' DataFormatString="{0:MM-yyyy}" ValidationGroup="add"></asp:TextBox>
                        <td align="right">
                            <b>Amount to Charge Card: $</b></td>
                            <asp:TextBox ID="AddressTextBox" runat="server" Columns="20" Rows="4" 
                                Text='<% #Bind("balance")%>' ValidationGroup="add"></asp:TextBox>
                    <asp:Button ID="CCButton" runat="server" onclick="CCButton_Click" align="right"
                      Text="Charge Card" /></td>

Too much code is missing to comment

For example if I write this in my code behind page aspx.cs

postData.Append("&AMT=BalanceTextBox") ;

When asp processes the code I get the actual text Balancetextbox, I need to get the value that is in balancetextbox.

I guess you havent understood what "" marks do and how to use any of the components..

If your textbox is called "BalanceTextBox" you get text out of it with BalanceTextBox.Text

You add that to the end of your string.. with a + mark.. and remove the rubbish you wrote in the value section

Got it thanks I used

<asp:TextBox ID="BalanceTextBox" runat="server" Columns="20" Rows="4"
Text='<% #Bind("balance")%>' ValidationGroup="add"></asp:TextBox>

then on the behind page

TextBox Balance = (TextBox)FormView1.FindControl("BalanceTextBox");
string myBalance = Balance.Text; // or you can convert it to int or whatever you need.

postData.Append("&AMT=" + myBalance);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.