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!