Ron Renninger
asked on
Post Form in asp.net in c#
Code is below
how do i combind the two buttons into one When i press get Token after getting the string i want to pass it to the form method post without an submit button. I looked into using javascript but do not see how that will work.
<form runat="server">
<asp:Button ID="GetToken" runat="server" Text="Get Token" OnClick="GetToken_Click" />
</form>
<form method="post" action="https://test.authorize.net/payment/payment"
id="formAuthorizeNetPage" >
<input type="text" name="Token" value="<%=token%>" />
<input type="submit" name="button" value="Buy now" />
how do i combind the two buttons into one When i press get Token after getting the string i want to pass it to the form method post without an submit button. I looked into using javascript but do not see how that will work.
<form runat="server">
<asp:Button ID="GetToken" runat="server" Text="Get Token" OnClick="GetToken_Click" />
</form>
<form method="post" action="https://test.authorize.net/payment/payment"
id="formAuthorizeNetPage" >
<input type="text" name="Token" value="<%=token%>" />
<input type="submit" name="button" value="Buy now" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it runs a class in c# and returns a value
so this, GetToken_Click, is a server side click?
if yes, then call whatever is needed when second form is submitted in this event...
or better move all logic into a new sub when 2nd form is submitted
and on GetToken_Click
if yes, then call whatever is needed when second form is submitted in this event...
or better move all logic into a new sub when 2nd form is submitted
page_load
if page,ispostback {
ProcessMain();
...
}
and on GetToken_Click
GetToken_Click() {
... process click event
ProcessMain();
}
<input type="submit" name="button" id="btnBuy" value="Buy now" />
then call
Open in new window
in GetToken_Click function...
are you using jQuery by the way?