Transfer Parameters for intermediate page Jump on HTML pages

Source: Internet
Author: User

In web project development, we often pass a large number of parameters from one page to another. When there are many parameters, we cannot directly pass them through the url, because the parameters passed in this way are limited, there are other methods, of course. We can use an html page as the intermediate page to post the data transmitted to the HTML page to another ASPX page through the post request. Implement mass data transfer across pages in ASP. NET. Put the following code directly:

Parent page:

Copy to ClipboardReference: [www.bkjia.com] <% @ 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> parent page </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 = "pop-up" onclick = "ShowDividePage ();"/>
</Div>
</Form>
</Body>
</Html>

HTML intermediate page:

Copy to ClipboardReference: [www.bkjia.com] <! 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 intermediate page </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>

Receiving parameters subpage:
Directly receive in the page_Load event:

Copy to ClipboardReference: [www.bkjia.com] 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 );
}
}
}

The effect is as follows:

Download instance:HTMLPop_bkjia.com.rar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.