zoukankan      html  css  js  c++  java
  • 传值

    1.querystring和a标签传值
      语法:目标页面?Text=所要传得值
      eg: "QuerystringTwo.aspx?Text=" + txtBox.Text.ToString();
      注释:这段代码是QuerystringOne.aspx的后台代码
     
    2.session
      语法:在当前页面定义,运行当前页面不要关闭。接着运行目标页面,输出结果。
      eg:
      SessionOne.aspx:
      Session["Text"] = txtBox.Text.ToString();
     
      SessionTwo.aspx:
      Response.Write(Session["Text"].ToString());
     
    3.Application
      语法: 定义和session一样,这个要在后面对目标页面进行指明
      eg:
      Application["Text"] = txtBox.Text.ToString();
      Server.Transfer("ApplicationTwo.aspx");
     
      string strText;
      Application.Lock();
      strText = Application["Text"].ToString();
      Response.Write(strText);
      Application.UnLock();
      
    4.Cookie
       语法:要用到HttpCookie对象,可以想象成键值对
       eg:HttpCookie Cookie = new HttpCookie("Text");
              Cookie.Value = txtBox.Text.ToString();
              Response.AppendCookie(Cookie);
              Server.Transfer("CookieTwo.aspx");
         
              string strCookie= Response.Cookies["Text"].Value.ToString();
              Response.Write(strCookie);
             
    5.Server.Transfer
       ServerOne页面
       public string StrText
            {
                get { return txtBox.Text; }
            }

            protected void btn_Click(object sender, EventArgs e)
            {
                Server.Transfer("ServerTwo.aspx");
            }
           
      protected void Page_Load(object sender, EventArgs e)
            {
                ServerOne serverOne=null;
                //定义第一个页面
                serverOne = (ServerOne)Context.Handler;
                Response.Write(serverOne.StrText.ToString());
            }

  • 相关阅读:
    选择率,基数计算公式
    10.2.0.1.1 grid control的启动和关闭
    重建控制文件
    批量构建添加数据文件SQL
    Flex内存泄露解决方法和内存释放优化原则
    [INS-32052] Oracle基目录和Oracle主目录位置相同
    [INS-20802] Oracle Database Configuration Assistant 失败
    Caused by:java.sql.SQLException:ORA-01008:并非所有变量都已绑定
    JSP中的include有哪些?有什么区别?
    解析XML的方法
  • 原文地址:https://www.cnblogs.com/meroselove/p/2208031.html
Copyright © 2011-2022 走看看