示例#1
0
 protected override void OnInit(EventArgs e)
 {
     if (Module.Section.CacheDuration > 0 &&
         Module.CacheKey != null &&
         !Page.User.Identity.IsAuthenticated &&
         !Page.IsPostBack)
     {
         // Get the cached content. Don't use cached output after a postback.
         if (HttpContext.Current.Cache[Module.CacheKey] != null && !IsPostBack)
         {
             // Found cached content.
             _cachedOutput = HttpContext.Current.Cache[Module.CacheKey].ToString();
         }
     }
     if (Page is PageEngine)
     {
         _pageEngine = (PageEngine)Page;
     }
     base.OnInit(e);
 }
 private void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         if (this.Page is PageEngine)
         {
             this._page = (PageEngine)this.Page;
             // Bind level 2 nodes
             if (this._page.ActiveNode.Level > 0)
             {
                 this.rptNav2.ItemDataBound += new RepeaterItemEventHandler(rptNav2_ItemDataBound);
                 this.rptNav2.DataSource     = this._page.ActiveNode.NodePath[1].ChildNodes;
                 this.rptNav2.DataBind();
             }
         }
     }
     catch (InvalidCastException ex)
     {
         throw new Exception("This control requires a Page of the type CMS.Web.UI.Page.", ex);
     }
 }