zoukankan      html  css  js  c++  java
  • 常见问题一:Ext.Net的缓存与session值在当前页总是不变

    问题是:之前做的显示菜单功能切换好用,可最近又不能切换了。

    处理描述:

    1.我在Page_Load事件进行给变量、缓存与session设置值。

    2.在其它事件中改变了变量、缓存与session的值,可调用了TreeStore1.LoadProxy();后再取变量时值没有变。调试了好久。。。。

    3.下面代码是运行总是有问题的,错误代码,请看一下正常是不是没什么问题啊,可就运行结果不对。

    static string strNewRoot = string.Empty; //在LoadParentModule()方法和其它事件中有获取与设置此值

     protected void Page_Load(object sender, EventArgs e)
         {
                if (!Page.IsPostBack)
                {

                   LoadParentModule();

                   if (!X.IsAjaxRequest)
                    {
                        this.ResourceManager1.DirectEventUrl = this.Request.Url.AbsoluteUri;
                     }
                }
        }

    4.后来经过测试跟踪终于发现了问题所在。改正的代码如下:

     在调用TreeStore1.LoadProxy();后就会触动Page_Load事件所以在LoadParentModule()方法中改回了原值,要想不被调用必须放在 if (!X.IsAjaxRequest)里。

    protected void Page_Load(object sender, EventArgs e)
    {
          if (!Page.IsPostBack)
          {
               if (!X.IsAjaxRequest)
               {
                       this.ResourceManager1.DirectEventUrl = this.Request.Url.AbsoluteUri;

                       LoadParentModule();
               }
          }
    }

  • 相关阅读:
    HDU 1358 Period (KMP)
    POJ 1042 Gone Fishing
    Csharp,Javascript 获取显示器的大小的几种方式
    css text 自动换行的实现方法 Internet Explorer,Firefox,Opera,Safar
    Dynamic Fonts动态设置字体大小存入Cookie
    CSS Image Rollovers翻转效果Image Sprites图片精灵
    CSS three column layout
    css 自定义字体 Internet Explorer,Firefox,Opera,Safari
    颜色选择器 Color Picker,Internet Explorer,Firefox,Opera,Safar
    CSS TextShadow in Safari, Opera, Firefox and more
  • 原文地址:https://www.cnblogs.com/spring_wang/p/3070942.html
Copyright © 2011-2022 走看看