带有操作网址的asp.net表单,按钮点击不起作用

时间:2015-06-23 04:50:01

标签: asp.net forms submit

我正在将支付网关集成到我的产品中。我必须向第三方支付提供商提交一个页面。在页面中,我在点击事件上有asp.button我想在会话中存储用户名和金额,当我点击页面发布到操作URL的按钮时,我的点击事件不会被调用。 如何从会话中获取值,然后我想发布页面。 这是代码

此致 阿伦

 <form  runat="server" method="post" action="https://secure.ogone.com/ncol/test/order.asp"  id="form1" name="form1" >
                        <!-- General information for the order -->

                        <input type="hidden" name="orderID" value="34567"/>
                        <input type="hidden" name="pspid" value="TESTMAS"/>
                        <input type="hidden" name="version" value="ncol_2.0"/>
                        <input type="hidden" name="language" value="en_US"/>
                        <input type="hidden" name="currency" value="EUR"/>
                        <input type="hidden" name="weightunit" value="kg"/>
                          <input type="hidden" name="accepturl" value="http://localhost:57249/pages/acceptPayment.aspx"/>
                        <input type="hidden" name="exceptionurl" value="http://localhost:57249/payment/pages/exception.aspx"/>
                        <input type="hidden" name="declineurl" value="http://localhost:57249/payment/pages/decline.aspx"/>
                        <input type="hidden" name="cancelurl" value="http://localhost:57249/payment/pages/cancel.aspx"/>
                        <input type="hidden" name="homeurl" value="http://localhost:57249/payment/updatePayment.aspx"/>
                        <input type="hidden" name="catalogurl" value="http://localhost:57249/payment/updatePayment.aspx"/>
                        <input type="hidden" name="SHASign" value="SHA-1"/>


                        <!-- or Template Page -->
                        <input type="hidden" name="TP" value="<Your template page URL>"/>
                        <input type="hidden" name="itemid" value="1"  />
                        <input type="hidden" name="itemname" value="Papercut Balance updation" />
                        <input type="hidden" name="itemdesc" value="Papercut Balance updation" />
                        <input type="hidden" name="taxincluded" value="0" />
                        <input type="hidden" name="itemvatcode" value="1" />
                        <input type="hidden" name="itemvat" value="" />
                        <input type="hidden" name="itemcomments" value="Papercut Balance updation" />
                        <input type="hidden" name="itemquant" value="1" />
                        <!-- First item of the order -->

                        <table>

                            <tr>
                                <td>username</td>
                                <td>  <asp:TextBox ID="txtusername"  Text="" runat="server"></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td>Payable Amount</td>
                                <td> <asp:TextBox ID="itemprice" Text=""  runat="server"></asp:TextBox></td>
                            </tr>

                            <tr>
                                <td colspan="1" >

                                    <asp:Button ID="Button1" runat="server" Text="ProceedToPay" OnClick="Button1_Click" />

                                </td>
                            </tr>

                        </table>

                        </form>


 protected void Button1_Click(object sender, EventArgs e)
    {

        String userName = Request["txtusername"];
        Double amount = Convert.ToDouble(Request["itemprice"]);

        try
        {
            Session["username"] = userName;
            Session["amount"] = amount;
        }
        catch (Exception e2)
        {
            System.Diagnostics.Debug.WriteLine(e2.Message + " " + e2.Source);
        }

    }

0 个答案:

没有答案