帖子ASP.Net表单数据到另一个页面 [英] Post ASP.Net Form data to another page

查看:159
本文介绍了帖子ASP.Net表单数据到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ASP.Net页,ASPX 其默认的形式。

I have an ASP.Net Page, aspx with its default form.

我有这方面的提交按钮。点击后,将数据上传给本身。换句话说,按钮单击事件()从code后面将执行必要的。

I have a Submit Button for it. Upon clicking, it will post the data to itself. In other words, Button Click Event() from code behind will execute the necessary.

在这之后,我想同样的数据发布到另一个 ASp.Net页,ASPX 从另一个域。

After that, I would like to post the same data to another ASp.Net Page, aspx from another domain.

那么,我该怎么办呢?

我试着在按钮点击事件的JavaScript 表格 C $ C>为提交表格,这样它会发布。但表没有出现,因此已经有一个 Form`在页面上。

I tried creating a Form in Button Click Event and a javascript to Submit the Form so that it will post. But the Form is not appearing hence there is already aForm` on the page.

反正有做呢?

推荐答案

使用按钮的PostBackUrl属性。 <一href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.postbackurl.aspx\">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.postbackurl.aspx

Use the Button's PostBackUrl property. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.postbackurl.aspx

<%@ page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
  <title>Button.PostBackUrl Example</title>
</head>
<body>    
  <form id="form1" runat="server">

    <h3>Button.PostBackUrl Example</h3>

    Enter a value to post:
    <asp:textbox id="TextBox1" 
      runat="Server">
    </asp:textbox>

    <br /><br />

    <asp:button id="Button1" 
      text="Post back to this page"
      runat="Server">
    </asp:button>

    <br /><br />

    <asp:button id="Button2"
      text="Post value to another page" 
      postbackurl="Button.PostBackUrlPage2cs.aspx" 
      runat="Server">
    </asp:button>

  </form>
</body>
</html>

这篇关于帖子ASP.Net表单数据到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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