本文介绍了会话可变怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过使用会话变量plz在下一页显示值,告诉我任何一个....

这是我的代码....

i want show values in next page by using session varibles plz tell me any one....

this is my code....

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Response.Write("you have sucessfully registred...!!!");
        }
    }

    protected void btnsubmit_Click1(object sender, EventArgs e)
    {
        Session["DEMO_SESSION"] = txtname.Text;
        Response.Redirect("default3.aspx");
    }


另一种形式的代码:-


another form code:-

protected void Page_Load(object sender, EventArgs e)
   {
       TextBox1.Text = Session["DEMO_SESSION"].ToString();
   }



但是我只得到一个名字,但是我想要所有信息以这种形式插入?



but I am getting only one name only but I want all information what i insert in the form?

推荐答案

if (TextBox1.Text!= "")
{
Session["DEMO_SESSION"] = TextBox1.Text;
Session.Timeout = 1;
Response.Redirect("Default2.aspx");
}
else
{
Session["DEMO_SESSION"] = "";
}
}
}


Session["DEMO_SESSION1"] = txtname.Text;
Session["DEMO_SESSION2"] = txtadd.Text;
Session["DEMO_SESSION3"] = txtphone.Text;



这篇关于会话可变怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 09:17
查看更多