protected void Page_Load(object sender, EventArgs e) { lblWelcome.Text = GetLabelText("Top_Welcome"); linkLogout.Text = GetLabelText("Top_Logout_Text"); linkLogout.ToolTip = GetLabelText("Top_Logout_ToolTip"); linkHomepage.Text = GetLabelText("Top_Homepage_Text"); linkHomepage.ToolTip = GetLabelText("Top_Homepage_ToolTip"); linkProfile.Text = GetLabelText("Top_Profile_Text"); linkProfile.ToolTip = GetLabelText("Top_Profile_ToolTip"); linkPassword.Text = GetLabelText("Top_Password_Text"); linkPassword.ToolTip = GetLabelText("Top_Password_ToolTip"); linkAbout.Text = GetLabelText("Top_About_Text"); linkAbout.ToolTip = GetLabelText("Top_About_ToolTip"); linkHelp.Text = GetLabelText("Top_Help_Text"); linkHelp.ToolTip = GetLabelText("Top_Help_ToolTip"); lblLogonUser.Text = DataConvert.GetString(Session["UserName"]); Johnny.CMS.BLL.SystemInfo.TopMenu topMenu = new Johnny.CMS.BLL.SystemInfo.TopMenu(); IList<Johnny.CMS.OM.SystemInfo.TopMenu> topMenuModel = topMenu.GetList(); foreach (Johnny.CMS.OM.SystemInfo.TopMenu item in topMenuModel) { WebTabPage tabPage = new WebTabPage(); tabPage.TabPageID = item.TopMenuId; tabPage.Text = item.TopMenuName; tabPage.Url = item.PageLink; tabPage.ToolTip = item.ToolTip; WebTab1.items.Add(tabPage); } }
private void BuildTabPage(TableRow tr, WebTabPage item, int index) { //<TD class=button_down id=IDC_DownedBUtton // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?type=000000');">快捷方式</TD> //left image TableCell tcPage = new TableCell(); tcPage.Text = item.Text; if (index == SelectedIndex) { tcPage.CssClass = "button_select"; } else { tcPage.CssClass = "button_down"; } tcPage.ID = "JohnnyTabPage" + index.ToString(); tcPage.Width = new Unit("82"); tcPage.ToolTip = item.ToolTip; tcPage.Style.Add("padding-left", "14px"); tcPage.Style.Add("cursor", "pointer"); tcPage.Style.Add("background-repeat", "no-repeat"); tcPage.Style.Add("text-align", "left"); tcPage.Attributes.Add("onclick", "CheckBTN1(this,'menu.aspx?topmenuid=" + item.TabPageID + "','" + item.Url + "')"); tr.Controls.Add(tcPage); }
private void BuildTabPage(TableRow tr, WebTabPage item, int index) { //<TD class=button_down id=IDC_DownedBUtton // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?type=000000');">快捷方式</TD> //left image TableCell tcPage = new TableCell(); tcPage.Text = item.Text; if (index == SelectedIndex) tcPage.CssClass = "button_select"; else tcPage.CssClass = "button_down"; tcPage.ID = "JohnnyTabPage" + index.ToString(); tcPage.Width = new Unit("82"); tcPage.ToolTip = item.ToolTip; tcPage.Style.Add("padding-left", "14px"); tcPage.Style.Add("cursor", "pointer"); tcPage.Style.Add("background-repeat", "no-repeat"); tcPage.Style.Add("text-align", "left"); tcPage.Attributes.Add("onclick", "CheckBTN1(this,'menu.aspx?topmenuid=" + item.TabPageID + "','" + item.Url + "')"); tr.Controls.Add(tcPage); }
/// <summary> /// Removes a specified MenuItem from the collection. /// </summary> /// <param name="item">The MenuItem instance to remove.</param> public void Remove(WebTabPage item) { tabPages.Remove(item); }
/// <summary> /// Inserts a MenuItem instance at a particular location in the collection. /// </summary> /// <param name="index">The ordinal location to insert the item.</param> /// <param name="item">The MenuItem to insert.</param> public virtual void Insert(int index, WebTabPage item) { tabPages.Insert(index, item); }
/// <summary> /// Returns the ordinal index of a MenuItem, if it exists; if the item does not exist, /// -1 is returned. /// </summary> /// <param name="item">The MenuItem to search for.</param> /// <returns>The ordinal position of the item in the collection.</returns> public virtual int IndexOf(WebTabPage item) { return(tabPages.IndexOf(item)); }
/// <summary> /// Determines if a particular MenuItem exists within the collection. /// </summary> /// <param name="item">The MenuItem instance to check for.</param> /// <returns>A Boolean - true if the MenuItem is in the collection, false otherwise.</returns> public virtual bool Contains(WebTabPage item) { return(tabPages.Contains(item)); }
/// <summary> /// Adds a MenuItem to the collection. If the ViewState is being tracked, the /// MenuItem's TrackViewState() method is called and the item is set to dirty, so /// that we don't lose any settings made prior to the Add() call. /// </summary> /// <param name="item">The MenuItem to add to the collection</param> /// <returns>The ordinal position of the added item.</returns> public virtual int Add(WebTabPage item) { int result = tabPages.Add(item); return(result); }
/// <summary> /// Returns the ordinal index of a MenuItem, if it exists; if the item does not exist, /// -1 is returned. /// </summary> /// <param name="item">The MenuItem to search for.</param> /// <returns>The ordinal position of the item in the collection.</returns> public virtual int IndexOf(WebTabPage item) { return tabPages.IndexOf(item); }
/// <summary> /// Determines if a particular MenuItem exists within the collection. /// </summary> /// <param name="item">The MenuItem instance to check for.</param> /// <returns>A Boolean - true if the MenuItem is in the collection, false otherwise.</returns> public virtual bool Contains(WebTabPage item) { return tabPages.Contains(item); }
/// <summary> /// Adds a MenuItem to the collection. If the ViewState is being tracked, the /// MenuItem's TrackViewState() method is called and the item is set to dirty, so /// that we don't lose any settings made prior to the Add() call. /// </summary> /// <param name="item">The MenuItem to add to the collection</param> /// <returns>The ordinal position of the added item.</returns> public virtual int Add(WebTabPage item) { int result = tabPages.Add(item); return result; }
/// <summary> /// BuildMenu builds the top-level menu. It is called from the OnDataBinding method as well /// as from <see cref="CreateChildControls"/>. It has code to check if the top-level menu should be /// laid out horizontally or vertically. /// </summary> protected virtual void BuildTab() { //<table style="BACKGROUND-IMAGE: url(images/menu_bg.jpg); WIDTH: 100%" cellSpacing=0 cellPadding=0 border=0> // <TR> // <TD> // <TABLE cellSpacing=0 cellPadding=0 border=0> // <TR> // <TD width=6 height=38></TD> // <TD class=button_down id=IDC_DownedBUtton // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?type=000000');">快捷方式</TD> // <TD class=button_down // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?Type=000000000006');">新闻管理</TD> // <TD class=button_down // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?Type=000000000003');">发布管理</TD> // <TD class=button_down // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?Type=000000000005');">会员中心</TD> // <TD class=button_down // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?Type=212263665712');">模型管理</TD> // <TD class=button_down // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?Type=160066612604');">插件管理</TD> // <TD class=button_down // style="PADDING-LEFT: 14px; WIDTH: 82px; CURSOR: pointer; BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: left" // onclick="CheckBTN1(this,'menu.aspx?Type=160066612603');">控制面版</TD> // </TR> // </TABLE> // </TD> // </TR> // </TABLE> // iterate through the Items Table webTab = new Table(); webTab.Attributes.Add("id", this.ClientID); webTab.CellPadding = 0; webTab.CellSpacing = 0; webTab.BorderWidth = 0; webTab.Width = new Unit("100%"); webTab.Style.Add("background-image", "url(images/topmenu/topmenu_bg.jpg)"); TableRow tr = new TableRow(); TableCell tc = new TableCell(); Table tbPages = new Table(); tbPages.BorderWidth = new Unit("0"); tbPages.CellPadding = 0; tbPages.CellSpacing = 0; TableRow trPages = new TableRow(); TableCell tcSpace = new TableCell(); tcSpace.Width = new Unit("6"); tcSpace.Height = new Unit("38"); trPages.Controls.Add(tcSpace); // Iterate through the top-level menu's menuitems, and add a <td> tag for each menuItem for (int ix = 0; ix < this.items.Count; ix++) { WebTabPage tabPage = this.items[ix]; BuildTabPage(trPages, tabPage, ix); } tbPages.Controls.Add(trPages); tc.Controls.Add(tbPages); tr.Controls.Add(tc); webTab.Controls.Add(tr); Controls.Add(webTab); }