⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controlheader.ascx.cs

📁 基于微软的 ASP.NET+C#开发的PETSHOP(网上宠物店)项目,在性能及开发效率上明显优于基于SUN J2EE框架开发的PETSHOP. 项目包括所有源码及数据库建库脚本,是不错的学习 AS
💻 CS
字号:
namespace PetShop.Web.Inc {

	using System;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///	Displays the top portion of the page. Displays correct 
	///	images, logged in menus and navigation menu items.
	///	Props:
	///	 ShowMenu - true if menu should be shown, otherwise false.
	/// </summary>
	public abstract class ControlHeader : System.Web.UI.UserControl {
		protected System.Web.UI.HtmlControls.HtmlImage lizard1;
		protected System.Web.UI.HtmlControls.HtmlImage lizard5;
		protected System.Web.UI.HtmlControls.HtmlImage lizard4;
		protected System.Web.UI.HtmlControls.HtmlGenericControl areaMenu;
		protected System.Web.UI.HtmlControls.HtmlGenericControl areaNoMenu;
		protected System.Web.UI.HtmlControls.HtmlGenericControl areaLoggedIn;
		protected System.Web.UI.HtmlControls.HtmlGenericControl areaLoggedOut;

		// properties
		public bool ShowMenu = true;

		private void Page_Load(object sender, System.EventArgs e) {
			ShowMenuArea();
			ShowLoggedInArea();
		}

		// display different items if person is logged in or not
		private void ShowLoggedInArea() {

			if (Request.IsAuthenticated == true) {
				areaLoggedIn.Visible = true;
				areaLoggedOut.Visible = false;
			}
			else {
				areaLoggedIn.Visible = false;
				areaLoggedOut.Visible = true;
			}
		}

		// hide or show menu items
		private void ShowMenuArea() {
			if (ShowMenu) {
				// show menu items
				areaMenu.Visible = true;
				lizard1.Visible = true;
				lizard4.Visible = true;
				lizard5.Visible = false;
				
				areaNoMenu.Visible = false;
			}
			else {
				// hide menu items
				areaMenu.Visible = false;
				lizard1.Visible = false;
				lizard4.Visible = false;				
				lizard5.Visible = true;

				areaNoMenu.Visible = true;
			}
		}

		#region Web Form Designer generated code
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent() {
			this.Load += new System.EventHandler(this.Page_Load);

		}

		private void Page_Init(object sender, EventArgs e) {
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
		}

		public ControlHeader() {
			this.Init += new System.EventHandler(Page_Init);
		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -