asp.net c# examples code for web developers.

How to use Menu control in asp.net

Menu web server control
Default.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to use Menu control in asp.net</title>
</head>
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">      
            How to use Menu
        </h2>      
        <hr width="450" align="left" color="Gainsboro" />
        <asp:SiteMapDataSource 
            ID="SiteMapDataSource1" 
            runat="server"
            />
        <asp:Menu 
            ID="Menu1" 
            runat="server" 
            DataSourceID="SiteMapDataSource1"
            Font-Size="X-Large"
            Font-Names="Comic Sans MS"
            StaticDisplayLevels="2"
            >
            <StaticHoverStyle BackColor="Gold" ForeColor="Crimson" />
            <DynamicHoverStyle BackColor="Gold" ForeColor="Crimson" />
        </asp:Menu>
    </div>
    </form>
</body>
</html>
Web.sitemap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode 
    url="Default.aspx" 
    title="Home"  
    description="Home Page"
    >
    <siteMapNode 
      url="StandardToolBox.aspx" 
      title="Standard ToolBox Control"  
      description="Standard ToolBox Control"
      >
      <siteMapNode 
        url="BulletedList.aspx" 
        title="BulltedList Example"  
        description="BulltedList Control Simple Example"
        />
      <siteMapNode 
        url="CheckBox.aspx" 
        title="CheckBox Example" 
        description="CheckBox Control Simple Example"
        />
      <siteMapNode 
        url="CheckBoxList.aspx" 
        title="CheckBoxList Example"
        description="CheckBoxList Control Simple Example"
        />
    </siteMapNode>
    <siteMapNode 
      url="DataToolBox.aspx" 
      title="Data ToolBox Control"  
      description="Data ToolBox Control"
      >
      <siteMapNode
        url="SqlDataSource.aspx" 
        title="SqlDataSource Example"  
        description="SqlDataSource Simple Example"
        />
      <siteMapNode 
        url="XmlDataSource.aspx" 
        title="XmlDataSource Example"  
        description="XmlDataSource Simple Example"
        />
    </siteMapNode>
  </siteMapNode>
</siteMap>
More asp.net examples
Copyright © 2008-2015 | asp.net c# examples | asp-net-example.blogspot.com | Author Saiful Alam