HTML页面做中间页跳转传递参数
2012-11-28 11:00
495 查看
在web项目开发中,我们经常会从一个页面 传递大量的参数到另外一个页面,当参数很多的时候我们不能通过url直接传递过去,因为这样传递的参数有限,那么有木有其他的方法呢,当然有。我们可以用一个html页面作为中间页,把传递到HTML页面的数据通过post 请求 post到另外一个ASPX页面。实现在ASP.NET中实现跨页面大批量数据传递。废话少说,直接上代码:
父页面:
HTML中间页:
接收参数 子页面:
直接在page_Load事件中接收:
效果如下:
点我下载
父页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="WebAppTest.index" %> <!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 runat="server"> <title>父页面</title> <script language="javascript" type="text/javascript"> function ShowDividePage() { var params = new Object(); params.Keys = "1234567890"; params.Code = "qwertyuioplkjhgfdsazxcvbnm"; var sFeature = "dialogWidth:500px; dialogHeight:250px;center:yes;help:no;resizable:no;scroll:auto;status:no"; var url = "Pop.htm?sysid=" + Math.random(); window.showModalDialog(url, params, sFeature); } </script> </head> <body> <form id="form1" runat="server"> <div> <input type="button" id="btn_Show" value="弹出" onclick="ShowDividePage();" /> </div> </form> </body> </html>
HTML中间页:
<!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> <title>HTML中间页</title> <script language="javascript" src="Scripts/jquery-1.4.1.min.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function () { window.name = "submitForm"; var keys = window.dialogArguments.Keys; var code = window.dialogArguments.Code; $("#hdKeys").val(keys); $("#hdCode").val(code); $("#submitForm").submit(); }); </script> </head> <body> <form id="submitForm" action="Show.aspx" method="post" target="submitForm"> <input type="hidden" id="hdKeys" name="hdKeys" /> <input type="hidden" id="hdCode" name="hdCode" /> </form> </body> </html>
接收参数 子页面:
直接在page_Load事件中接收:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebAppTest { public partial class Show : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string keys = Request.Form["hdKeys"]; string Code = Request.Form["hdCode"]; Response.Write(keys); Response.Write(Code); } } }
效果如下:
点我下载
相关文章推荐
- HTML页面做中间页跳转传递参数
- html页面跳转传递参数
- HTML页面跳转及参数传递问题
- html页面跳转传递参数
- html页面跳转及参数传递
- html中如何在页面跳转中传递参数
- 在一个页面文件中(JSP 或者HTML)使用href 跳转另一个页面时使用Js中获取传递过来的参数
- html两个页面跳转时传递参数location.search
- ASP.NET页面跳转并传递参数
- AJAX扩展-POST传递参数并跳转页面
- 微信小程序——页面跳转传递参数(实体,对象)
- 纯html静态页面怎么获取参数(用javascript传递页面参数)
- 用javascript实现html页面之间的参数传递的四种方法
- HyperLink跳转页面传递绑定参数
- Activity中使用Intent实现页面跳转与参数的传递
- Jsp与servlet之间页面跳转及参数传递实例(转)
- ReactNative基础(五)使用react-navigation实现页面的跳转、参数的传递(StackNavigator)
- 用javascript实现html页面之间的参数传递
- jquerymobile页面跳转和参数传递
- 纯HTML页面之间传递参数