Session["myCartTable"]=数组;另一个页面中,接收就是了.

解决方案 »

  1.   

    //send
    string strPR = null;
    for (int i=0;i<pr.Length;i++)
    {
    strPR += pr[i] + ";";
    }
    session["PR"] = strPR;
    //receive
    string strPR = session["PR"].ToString();
    string[] pr = null;//pr为接收数组
    pr = strPR.Split(new char[] {';'});
      

  2.   

    把数组设为public就行,以下是个测试:
    WebForm1.aspx.cs:
    namespace WebApplication1
    {
    /// <summary>
    /// WebForm1 的摘要说明。
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
    public string[] arystr=new string[]{"1","2","3"};
    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Load += new System.EventHandler(this.Page_Load);
    }
    #endregion
    }
    }
    WebForm2.aspx.cs:
    namespace WebApplication1
    {
    /// <summary>
    /// WebForm2 的摘要说明。
    /// </summary>
    public class WebForm2 : System.Web.UI.Page
    {
    WebForm1 myewb=new WebForm1();
    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面 Response.Write(myewb.arystr[0]+myewb.arystr[1]+myewb.arystr[2]);
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Load += new System.EventHandler(this.Page_Load);
    }
    #endregion
    }
    }
      

  3.   

    zhangqiushui( 水):接收的pr数组是个string型,不能转换成double型啊?
      

  4.   

    public partial class Array : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string[] a =new string[4];
            for (int i = 0; i < 4;i++ )
            {
                a[i] = (i + 1).ToString();
            }
            Session["a"]=a;
        }
    }
    ////////////////////////////////////////////////////
    public partial class GetArray : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string[] a = Session["a"] as string[];
            for (int i = 0; i < 4;i++ )
            {
                Response.Write(a[i]);
            }
        }
    }
    ///////////////////////////////////////////////////////////
    所有问题都可照此解决
      

  5.   

    直接传过去就行了..
    那边也直接接收.
    string[] a = Session["a"] as string[];
      

  6.   

    我需要发送的数组是double型,接收的数组也是double型,可是上面各位的答案都是string型的,那接下来的程序我就没办法做了,谁能提供一个直接将double型传到double型的程序?或者在接收页面将string型变换成double型的数组。
      

  7.   

    感觉数组内容不多的话,使用URL参数传递过去也很方便. 
    建一个Session会话变量也挺方便的.