YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

How to set amount dynamically using asp.net drop down Options
ginger
#1 Posted : Friday, June 03, 2011 11:14:02 AM
Rank: Starting Member

Groups: Registered

Joined: 6/3/2011
Posts: 1
Location: london
I used the 'buy now' button code from paypal site and I'm trying to set the amount input text using asp.net drop down control. I have the following:

Code:
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentMainContentArea">
    <form id="form1" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" runat="server">


<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="test@test.com" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="undefined_quantity" value="1" />
<input type="hidden" name="item_name" value="Test" />
<input type="hidden" name="item_number" value="123" />
<input type="hidden" name="amount" id="myAmount" value="5" runat="server" />
<input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="image" src="http://images.paypal.com/images/x-click-but01.gif" name="submit"
alt="" runat="server" />

Asp.Net drop down:

£<asp:DropDownList ID="ddlAmount" AutoPostBack="true" runat="server" Width="200px"
OnSelectedIndexChanged="ddlAmountChanged">
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
</asp:DropDownList>
Code behind:

protected void ddlAmountChanged(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
myAmount.Value = SelectedValue;
}
}

The bold line has a default value of 5. But after I added runat it does not get set. I need to set that dynamically using drop down list. Any suggestions? Thanks!
Sponsor  
 
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.129 seconds.