Asp.net 4.0 menu control style + XML file configuration

Source: Internet
Author: User

I have made little work on the design of web UI, most of the time it is developed at the backend. This example has been done, recorded, and made a reference later.

The menu effect is as follows:

It is inconvenient to change the background color with the mouse on the menu and the font color.

Style File topmenu.css

.staticMenu{    background-color: #e4f0ff;    font-family: Arial;    display: block;    font-size: 17px;    color: #1092E0;}.staticMenu:hover{    font-weight: bold;    background-color: #c9e1fd;    color: #1092E0;}.staticMenuItem{    background-color: #e4f0ff;    font-family: Arial;    font-size: 17px;    color: #1092E0;}.staticMenuItem:hover{    font-weight: bold;}.dynamicMenu{    border-style: solid;    border-width: 1px;    font-family: Arial;    font-size: 12px;    color: #ffffff;    background-color: #3582E4;}.dynamicMenu:hover{    border-style: solid;    border-width: 1px;    font-family: Arial;    font-size: 12px;    font-weight: bold;    color: #1092E0 !important;    background-color: #c9e1fd;}dynamicMenu:hover a{    background-color: #c9e1fd;}.dynamicMenuItem{    border-style: solid;    border-width: 1px;    font-family: Arial;    font-size: 12px;    color: #ffffff;    background-color: #3582E4;}.dynamicMenuItem:hover{    border-style: solid;    border-width: 1px;    font-family: Arial;    font-size: 12px;    font-weight: bold;    color: #1092E0 !important;    background-color: #c9e1fd;}dynamicMenuItem:hover a{    background-color: #c9e1fd;}

Page code

    <div id="menuDiv" style="background: #e4f0ff; width: 100%">        <asp:Menu ID="menuController" runat="server" DataSourceID="XmlDataSource1" Orientation="Horizontal"            StaticEnableDefaultPopOutImage="True" StaticTopSeparatorImageUrl="~/Images/spliter.gif"            IncludeStyleBlock="false">            <DataBindings>                <asp:MenuItemBinding DataMember="menuItem" Depth="0" TextField="title" />                <asp:MenuItemBinding DataMember="subItem" Depth="1" NavigateUrlField="url" TextField="title" />                <asp:MenuItemBinding DataMember="reportItem" Depth="2" NavigateUrlField="url" TextField="title" />            </DataBindings>            <StaticMenuItemStyle CssClass="staticMenu" HorizontalPadding="20px" VerticalPadding="10px" />            <DynamicMenuItemStyle CssClass="staticMenu" HorizontalPadding="20px" VerticalPadding="5px" />            <StaticMenuItemStyle CssClass="staticMenuItem" />            <DynamicMenuStyle CssClass="dynamicMenu" />            <DynamicMenuItemStyle CssClass="dynamicMenuItem" />        </asp:Menu>    </div>

As you can see from the above, the menu item also defines the depth (depth = "XX"). If you don't know, can you choose not to set this item for automatic recursive rendering? Please try again later ......

There is a white separator between the above menu items, which is actually an image and a white image with a vertical length, below is the xml configuration menu (note that you drag an xmlperformance1 control to set a specific XML file)

Menu. xml

<menu>  <menuItem title="Reports"  description="">    <subItem title="Program" url ="">      <reportItem title="By program" url ="~/byprogram.aspx"/>      <reportItem title="By Program with Cust Ref" url ="~/byprogramwithcustref.aspx"/>    </subItem>    <subItem title ="HM Combos" url ="">      <reportItem title="H/M Combo" url ="~/hmcombo.aspx"/>      <reportItem title="H/M Item Combo" url ="~/hmitemcombo.aspx"/>      <reportItem title="HM Combo Summary" url ="~/hmcombosummary.aspx"/>    </subItem>    <subItem title ="Summary" url ="~/summary.aspx"/>    <subItem title ="Average" url ="~/average.aspx"/>  </menuItem>  <menuItem title="I-E Loading Ratio"  description="">    <subItem title="Internal External Loading Ratio" url ="~/hmieratio.aspx "/>    <subItem title="I-E Loading Ratio Summary" url ="http://wdmyaxdb/ReportServer/Pages/ReportViewer.aspx?%2fHMLP%2fRpt_Summary"/>    <subItem title="I-E Loading Ratio Chart" url ="http://wdmyaxdb/ReportServer/Pages/ReportViewer.aspx?%2fHMLP%2fRpt_Summary_Chart"/>  </menuItem></menu>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.