使用Jquery向一个空白网页动态创建一个iframe,及嵌入页面,和向嵌入页面传参

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Collections.Specialized;
using Microsoft.JScript;
namespace MCS
{
    public partial class MyDialog : System.Web.UI.Page
    {
        protected string strParam = null;
        private void Page_Load(System.Object sender, System.EventArgs e)
        {

        }

        public string GetParam()
        {
            strParam = string.Empty;
            int loop1 = 0;
            int loop2 = 0;
            string[] arr1 = null;
            string[] arr2 = null;
            NameValueCollection coll = null;

            //Load Form variables into NameValueCollection variable.
            coll = Request.QueryString;
            //Get Names of all keys into a string array.
            arr1 = coll.AllKeys;
            for (loop1 = 0; loop1 <= arr1.GetUpperBound(0); loop1++)
            {
                strParam = strParam + arr1[loop1] + "=";
                // Get all values under this key.
                arr2 = coll.GetValues(loop1);
                for (loop2 = 0; loop2 <= arr2.GetUpperBound(0); loop2++)
                {
                    if (Information.IsDate(arr2[loop2]))
                        arr2[loop2] = DateTime.Parse(arr2[loop2]).ToString("MM/dd/yyyy hh:mm:ss tt");

                    strParam = strParam + arr2[loop2] + "&";
                }
            }

            if (strParam.Length > 0 && strParam.Contains("&"))
                strParam = strParam.TrimEnd('&');
            return strParam;
        }

        public string GetPage()
        {
            return Request.QueryString["Page"];
        }
    }
}

以上GetPage方法得到iframe里嵌入的页面,GetParam方法则是得到要传递的参数

下面是前台Jquery页面

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyDialog.aspx.cs" Inherits="MCS.MyDialog" %>




    Dialog
    
    




至于为什么要放在iframe里面,而不直接使用load方法,是为了防止跳转时弹出一个新页面,而不是在本页面中跳转

你可能感兴趣的:(JQuery,Asp.Net)