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
-----------------------------------------
.aspx

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

-----------------------------------
.aspx.cs

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 = "";
            CustSearch.Focus();
                  
        }
        else
        {
            Response.Redirect("./Login.aspx");
        }

    }
    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]http://www.pdncommunity.com/pdn/board/message?board.id=payflow&message.id=569[/url]

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



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

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

            //wrWebRequest.Headers.Add("X-VPS-VIT-Client-Certification-Id:10");

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



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

            //test pilot-payflowpro.paypal.com

            string postURL = "https://pilot-payflowpro.paypal.com";

            //live

            //string postURL = "https://payflowpro.verisign.com/transaction";
            
            //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("&TRXTYPE=S");
            // postData.Append("&AMT=1.00");
            GetDataItem(%# Eval("balance") %;


            //this is in the format MMYY

            postData.Append("&EXPDATE=0109");
            postData.Append("&ACCT=5105105105105100");
            postData.Append("&CVV2=123");
            postData.Append("&FIRSTNAME=bob");
            postData.Append("&LASTNAME=smith");
            postData.Append("&STREET=155515 Q St");
            postData.Append("&STATE=NE");
            postData.Append("&CITY=Omaha");
            postData.Append("&ZIP=68137");
            postData.Append("&COUNTRY=US");
            //C is for credit card, P is for PayPal Express Checkout. More in the docs
            postData.Append("&TENDER=C");

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

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

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

            postData.Append("&email=ryan.fitz@vortexamerica.com");

            //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:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7";

            wrWebRequest.ContentType = "text/namevalue";

            wrWebRequest.ContentLength = requestBytes.Length;

            wrWebRequest.AllowAutoRedirect = false;



            //add the custom headers

            wrWebRequest.Headers.Add("X-VPS-Timeout:30");
            wrWebRequest.Headers.Add("X-VPS-VIT-Client-Architecture:x86");
            wrWebRequest.Headers.Add("X-VPS-VIT-Client-Certification-Id:14");
            wrWebRequest.Headers.Add("X-VPS-VIT-Client-Type:ASP.NET");
            wrWebRequest.Headers.Add("X-VPS-VIT-Client-Version:0.0.1");
            wrWebRequest.Headers.Add("X-VPS-VIT-Integration-Product:Homegrown");
            wrWebRequest.Headers.Add("X-VPS-VIT-Integration-Version:0.0.1");
            wrWebRequest.Headers.Add("X-VPS-VIT-OS-Name:windows");
            wrWebRequest.Headers.Add("X-VPS-VIT-OS-Version:2002_SP2");



            // 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();

            reqStream.Close();

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



            string responseData = responseReader.ReadToEnd();
            responseReader.Close();
            //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"

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

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

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);

This article has been dead for over six months. Start a new discussion instead.