zoukankan      html  css  js  c++  java
  • 页面跳转最后返回让原页面保持结果

    1:在同一个页面,工具功能,显示和隐藏不同的PANL。不涉及到页面之间传值

    2:在新窗口中打开

    3:使用弹出层

    4:视图状态

    5:post数据到详细页面,然后在详细页点返回的时候再post回来

    但是我的项目不可能大改,只能在原来的基础上改了。改的办法有很多种

    1:SESSION,不推荐,会影响程序性能

    2:URL参数:不安全,因为参数会暴露在外面

    3:通过HttpContext.Current.Handler来获取

    public partial class Serach : System.Web.UI.Page
    {
        
    protected void Page_Load( object sender, EventArgs e )
        
    {
            
    if ( !IsPostBack )
            
    {
                Result result;
                
    if ( HttpContext.Current.Handler is Result )
                
    {
                    result 
    = HttpContext.Current.Handler as Result;
                    Response.Write( result.text );
                }

            }

        }


        
    public string datatime
        
    {
            
    get return this.TextBox1.Text; }
            
    set this.TextBox1.Text = value; }
        }


        
    protected void Button1_Click( object sender, EventArgs e )
        
    {
            Server.Transfer( 
    "Result.aspx" );
        }

    }

    //查询页面

     

    public partial class Result : System.Web.UI.Page
    {
       
        
    protected void Page_Load(object sender, EventArgs e)
        
    {
            
    if ( !IsPostBack )
            
    {
                Serach serach;
                
    if ( HttpContext.Current.Handler is Serach )
                
    {
                    serach 
    = HttpContext.Current.Handler as Serach;
                    
    this.HiddenField1.Value=serach.datatime ;
                }

            }

        }


        
    public string text
        
    {
            
    get return this.HiddenField1.Value; }
            
    set this.HiddenField1.Value = value; }
        }

        
    protected void btnText_Click( object sender, EventArgs e )
        
    {
            Server.Transfer( 
    "Serach.aspx" );
        }

    }

    //结果页面

     http://www.cnblogs.com/mFrog/archive/2009/03/05/1403979.html

  • 相关阅读:
    Json 操作
    visual studio 单元测试的认识
    EntityFramework 贪婪加载与延迟加载以及资源回收
    idea 查看源码
    idea技巧快速生成构造函数 get set
    Spring Boot Jpa框架自定义查询语句返回自定义实体
    启动redis
    查找nginx安装目录并启动
    idea技巧 --查找当前方法都被哪些类引用
    第一个webapi及swagger
  • 原文地址:https://www.cnblogs.com/yidianfeng/p/1404416.html
Copyright © 2011-2022 走看看