context: /********
   * This file is part of Ext.NET.
   *     
   * Ext.NET is free software: you can redistribute it and/or modify
   * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as 
   * published by the Free Software Foundation, either version 3 of the 
   * License, or (at your option) any later version.
   * 
   * Ext.NET is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
   * 
   * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
   * along with Ext.NET.  If not, see <http://www.gnu.org/licenses/>.
   *
   *
   * @version   : 1.2.0 - Ext.NET Pro License
   * @author    : Ext.NET, Inc. http://www.ext.net/
   * @date      : 2011-09-12
   * @copyright : Copyright (c) 2006-2011, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
   * @license   : GNU AFFERO GENERAL PUBLIC LICENSE (AGPL) 3.0. 
   *              See license.txt and http://www.ext.net/license/.
   *              See AGPL License at http://www.gnu.org/licenses/agpl-3.0.txt
   ********/
  
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Drawing.Design;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  using Ext.Net.Utilities;
  
  namespace Ext.Net
  {
      /// <summary>
      /// 
      /// </summary>
      [Meta]
      [Description("")]
      public abstract partial class MenuItemBase : BaseMenuItem, IIcon, IAutoPostBack, IPostBackEventHandler, IButtonControl
      {
          /// <summary>
          /// 
          /// </summary>
          [Description("")]
          protected override void OnBeforeClientInitHandler()
          {
              base.OnBeforeClientInitHandler();
  
              if (this.OnClientClick.IsNotEmpty())
              {
                  this.On("click", new JFunction(TokenUtils.ParseTokens(this.OnClientClick, this), "el", "e"));
              }
  
              string fn = this.PostBackFunction;
  
              if (this.ParentForm != null && fn.IsNotEmpty())
              {
                  this.On("click", new JFunction(fn));
              }
          }
  
          /*  PostBack
              -----------------------------------------------------------------------------------------------*/
  
          /// <summary>
          /// 
          /// </summary>
          [Meta]
          [DefaultValue("")]
          [UrlProperty("*.aspx")]
          [Editor("System.Web.UI.Design.UrlEditor", typeof(UITypeEditor))]
          [Description("")]
          public virtual string PostBackUrl
          {
              get
              {
                  return (string)this.ViewState["PostBackUrl"] ?? "";
              }
              set
              {
                  this.ViewState["PostBackUrl"] = value;
              }
          }
  
  
          /*  EventClick
              -----------------------------------------------------------------------------------------------*/
  
          private static readonly object EventClick = new object();
  
          /// <summary>
          /// Fires when the button has been clicked
          /// </summary>
          [Category("Action")]
          [Description("Fires when the button has been clicked")]
          public event EventHandler Click
          {
              add
              {
                  this.Events.AddHandler(EventClick, value);
              }
              remove
              {
                  this.Events.RemoveHandler(EventClick, value);
              }
          }
  
          /// <summary>
          /// 
          /// </summary>
          /// <param name="e"></param>
          [Description("")]
          protected virtual void OnClick(EventArgs e)
          {
              EventHandler handler = (EventHandler)this.Events[EventClick];
  
              if (handler != null)
              {
                  handler(this, e);
              }
          }
  
          /// <summary>
          /// 
          /// </summary>
          /// <param name="eventArgument"></param>
          [Description("")]
          protected virtual void RaisePostBackEvent(string eventArgument)
          {
              if (this.CausesValidation)
              {
                  this.Page.Validate(this.ValidationGroup);
              }
              this.OnClick(EventArgs.Empty);
              this.OnCommand(new CommandEventArgs(this.CommandName, this.CommandArgument));
          }
  
          void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
          {
              this.RaisePostBackEvent(eventArgument);
          }
  
  
          /*  EventCommand
              -----------------------------------------------------------------------------------------------*/
  
          private static readonly object EventCommand = new object();
  
          /// <summary>
          /// 
          /// </summary>
          [Category("Action")]
          [Description("")]
          public event CommandEventHandler Command
          {
              add
              {
                  base.Events.AddHandler(EventCommand, value);
              }
              remove
              {
                  base.Events.RemoveHandler(EventCommand, value);
              }
          }
  
          /// <summary>
          /// 
          /// </summary>
          /// <param name="e"></param>
          [Description("")]
          protected virtual void OnCommand(CommandEventArgs e)
          {
              CommandEventHandler handler = (CommandEventHandler)base.Events[EventCommand];
  
              if (handler != null)
              {
                  handler(this, e);
              }
              base.RaiseBubbleEvent(this, e);
          }
  
          /// <summary>
          /// 
          /// </summary>
          [DefaultValue("")]
          [Description("")]
          public string CommandName
          {
              get
              {
                  string str = (string)this.ViewState["CommandName"];
  
                  if (str != null)
                  {
                      return str;
                  }
  
                  return "";
              }
              set
              {
                  this.ViewState["CommandName"] = value;
              }
          }
  
          /// <summary>
          /// 
          /// </summary>
          [DefaultValue("")]
          [Description("")]
          public string CommandArgument
          {
              get
              {
                  string str = (string)this.ViewState["CommandArgument"];
  
  
gt:                 if (str != null)