Friday, May 20, 2011

OnInit Event


using System;
using System.Web.UI;
public partial class _Default : Page
{
 protected override void OnInit(EventArgs e)
 {
  this.PreRender += delegate
  {
   this.PartsCatalogPanel.Visible = (this.WebPartManager.DisplayMode.Name == "Catalog");
   this.EditZonePanel.Visible = (this.WebPartManager.DisplayMode.Name == "Edit");
   this.ConnectionsPanel.Visible = (this.WebPartManager.DisplayMode.Name == "Connect");
  };
  this.CurrentModeDropDownList.SelectedIndexChanged += delegate
  {
   this.WebPartManager.DisplayMode = this.WebPartManager.DisplayModes[this.CurrentModeDropDownList.SelectedValue];
  };
  this.ResetButton.Click += delegate
  {
   this.WebPartManager.Personalization.ResetPersonalizationState();
   this.Response.Redirect(this.Request.Url.PathAndQuery, true);
  };
  this.WebPartManager.WebPartClosing += delegate
  {
   this.Response.Redirect(this.Request.Url.PathAndQuery, true);
  };
  this.CurrentModeDropDownList.DataSource = this.WebPartManager.SupportedDisplayModes;
  this.CurrentModeDropDownList.DataBind();
  base.OnInit(e);
  base.OnInit(e);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

No comments: