JQuery不同页面间传递数组
页面1
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script>
function delset() {
var arr = new Array("dsdds", "dsds", "aaa", "fdfff", "dddd");
location.href = "About.aspx?arr=" + arr;
}
</script>
<input type="checkbox" name="checkbox" id="checkbox"><input type="button" id="button" value="Click Me" onclick="getcheckbox()">
<input id="Button1" type="button" value="button" onclick="delset()" />
</asp:Content>
页面2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class About : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string strArr = Request["arr"].ToString();
string[] arr = strArr.Split(',');
for (int i = 0; i < arr.Length; i++)
{
Response.Write(arr[i] + "<br />");
}
}
}