📄 usermenu.ascx.cs
字号:
namespace Seaskyer.WebApp.skyNews.Pages.UserMSC.CUserControls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Seaskyer.WebApp.Utility;
/// <summary>
/// UserMenu 的摘要说明。
/// </summary>
public class custom : baseUserControl
{
protected System.Web.UI.HtmlControls.HtmlGenericControl customMenu;
private void Page_Load(object sender, System.EventArgs e)
{
//Page.DataBind();
//HyperLink
//Panel
userCookie cookie = new userCookie("UserCustomConfig");
if( cookie["activeMenu"] == "true" )
customMenu.Attributes.Add("style", "display:none;");
else
customMenu.Attributes.Add("style", "display:block;");
// 遍历所有 HyperLink 控件,对当前页导航进行设置
foreach( Control ctrl in customMenu.Controls )
{
foreach (Control c in ctrl.Controls)
{
if( c.GetType() == typeof(HyperLink) )
{
HyperLink h = (HyperLink)c;
if( h.NavigateUrl.ToLower().IndexOf(this.controlPath.Replace("ascx", "aspx")) > -1 )
{
h.BackColor = Color.Brown;
h.ForeColor = Color.White;
}
}
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ID = "custom";
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -