zoukankan      html  css  js  c++  java
  • Asp.net菜单控件

      以前看UCHome进行二次开发的时候,看到他的菜单的实现,是通过数组存储每个菜单的样式。

      现在在.NET开发项目时,想采用类似的方法。

    Menu.ascx<style type="text/css">
    .b{font-weight:bold;}

    </style>

    <ul>

      <li<%=ht["Index"]%>>首页</li>

      <li<%=ht["News"]%>>公司新闻</li>

      <li<%=ht["AboutUs"]%>>关于我们</li> 

    </ul>

     
    Menu.ascx.cspublic partial class Menu:System.Web.UI.UserControl

    {

      protected Hashtable ht = new Hashtable();

      public string strStyle = null ;

      protected void Page_Load(object sender,EventArgs e)

      {

        ht[strStyle] = " class=\"b\"";

      }

     } 

    Index.aspx<%@ Register Src="~/Controls/Menu.asx" TagPrefix="Lee" TagName="Menu" %>
    <Lee:Menu ID="Menu" runat="server" strStyle="Index"/>
     
  • 相关阅读:
    MySQL
    MySQL -数据库备份
    MySQL
    MySQL
    MySQL
    MySQL
    MySQL
    MySQL
    MySQL
    53端口反弹shell
  • 原文地址:https://www.cnblogs.com/AngelLee2009/p/1881160.html
Copyright © 2011-2022 走看看