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

  • 相关阅读:
    读书笔记:A Philosophy of Software Design
    面向对象编程—价值万亿美元的灾难
    刚哥谈架构 (二) 我眼中的架构师
    软件质量成本神话
    API 如何选择 REST,GraphQL还是gRPC
    影响您的代码库的10个编程代码味道
    为什么要不断重构
    php导出excel表格的使用
    浅谈HTTP中Get与Post的区别
    C# 程序配置文件的操作(ConfigurationManager的使用)
  • 原文地址:https://www.cnblogs.com/yidianfeng/p/1404416.html
Copyright © 2011-2022 走看看