使用form method =" post"时按钮点击事件不会触发 [英] button click event does not fire when using form method="post"

查看:77
本文介绍了使用form method =" post"时按钮点击事件不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个.aspx页面并集成到asp.net中的支付网关。



我有四个隐藏字段和一个按钮控件。表单标签已将action属性设置为sagepay和method =post的URL。当我点击按钮控件时,服务器代码没有执行,它重定向到sage pay。我需要执行按钮点击事件,所以在将用户重定向到sagepay网站之前,我需要将订单信息存储在数据库表中。



我已经尝试过使用Response。重定向这个不起作用。

有人知道如何解决这个问题吗?或者在asp.net中集成sagepay的任何其他方式。





.aspx页面:

< form id =form2action =https://test/gateway/test.jsp

method =post>

< input type =隐藏name =VPSProtocolvalue =2.23/>

< input type =hiddenname =TxTypevalue =PAYMENT/>

< input type =hiddenname =Vendorvalue =vendorname/>

< input type =hiddenname =Cryptvalue =orderInfo/ >

< asp:Button ID =btnTestrunat =serverText =Test SagePayrunat =serverOnClick =onclick_click/>

< / form>



谢谢

Nagaraj

Hi All,
I have one .aspx page and integrating to payment gateway in asp.net.

I have four hidden field and one button control. form tag has action attribute has been set as URL of sagepay and method="post". When I click on button control, server code is not executing and it redirects to sage pay. I need to execute button click event so before redirecting user to sagepay website, I need to store order information in database table.

I already tried with Response.Redirect this one not working.
can anybody know how to fix this issue? Or any other way to integrate sagepay in asp.net.


.aspx page:
<form id="form2" action="https://test/gateway/test.jsp"
method="post">
<input type="hidden" name="VPSProtocol" value="2.23" />
<input type="hidden" name="TxType" value="PAYMENT" />
<input type="hidden" name="Vendor" value="vendorname" />
<input type="hidden" name="Crypt" value="orderInfo" />
<asp:Button ID="btnTest" runat="server" Text="Test SagePay" runat="server" OnClick="onclick_click" />
</form>

Thanks
Nagaraj

推荐答案

<form id="form1" runat="server" method="post">    
    <asp:button id="btnTest" runat="server" text="Test SagePay" onclick="btnTest_click" xmlns:asp="#unknown" />
</form>











and

protected void btnTest_click(object sender, EventArgs e)
        {
            //Code to save values into DB;
            Response.Redirect("https://test/gateway/test.jsp");
        }





希望有所帮助。



Hope it helps.


这篇关于使用form method =&quot; post&quot;时按钮点击事件不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆