Tuesday, June 26, 2012

SiteMapPath using asp.net,example of SiteMapPath,with screenshot,why we use



ButtonExample.aspx

  1. <%@ Page Language="C#" %>  
  2. <%@ Import Namespace="System.Drawing" %>  
  3.   
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  5.   
  6. <script runat="server">  
  7.     protected void Button1_Click(object sender, System.EventArgs e)  
  8.     {  
  9.         SiteMapPath1.BackColor = Color.Cornsilk;  
  10.         SiteMapPath1.ForeColor = Color.Crimson;  
  11.         SiteMapPath1.Font.Size = FontUnit.Large;  
  12.         SiteMapPath1.Font.Italic = true;  
  13.         SiteMapPath1.PathSeparator = " / ";  
  14.         SiteMapPath1.NodeStyle.ForeColor = Color.PaleVioletRed;  
  15.         SiteMapPath1.Font.Bold = true;  
  16.         SiteMapPath1.RootNodeStyle.Font.Size = FontUnit.XLarge;  
  17.     }  
  18. </script>  
  19.   
  20. <html xmlns="http://www.w3.org/1999/xhtml">  
  21. <head id="Head1" runat="server">  
  22.     <title>How to set, change SiteMapPath style programmatically</title>  
  23. </head>  
  24. <body>  
  25.     <form id="form1" runat="server">  
  26.     <div>  
  27.         <h2 style="color:Navy">SiteMapPath Example: Style</h2>  
  28.         <asp:SiteMapPath   
  29.              ID="SiteMapPath1"   
  30.              runat="server"  
  31.              >  
  32.         </asp:SiteMapPath>  
  33.         <br /><br /><br /><br />  
  34.         <asp:Button   
  35.              ID="Button1"   
  36.              runat="server"  
  37.              ForeColor="SteelBlue"  
  38.              Text="Change SiteMapPath Style"  
  39.              Height="45"  
  40.              OnClick="Button1_Click"  
  41.              Font-Bold="true"  
  42.              />  
  43.     </div>  
  44.     </form>  
  45. </body>  
  46. </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="StandardToolBox" description="StandardToolBox Controls">
      <siteMapNode url="AdRotatorExample.aspx" title="AdRotator"  description="AdRotator Example" />
      <siteMapNode url="BulletedListExample.aspx" title="BulletedList"  description="BuulletedList Example" />
      <siteMapNode url="ButtonExample.aspx" title="Button"  description="Button Example" />
      <siteMapNode url="CalendarExample.aspx" title="Calendar"  description="Calendar Example" />
    </siteMapNode>
    <siteMapNode url="DataToolBox.aspx" title="DataToolBox" description="DataToolBox controls">
      <siteMapNode url="ListViewExample.aspx" title="ListView"  description="ListView Example" />
      <siteMapNode url="GridViewExample.aspx" title="GridView"  description="GridView Example" />
    </siteMapNode>
    <siteMapNode url="NavigationToolbox.aspx" title="Navigation Toolbox" description="NavigationToolbox controls">
      <siteMapNode url="MenuExample.aspx" title="Menu"  description="Menu Example" />
      <siteMapNode url="SiteMapPathExample.aspx" title="SiteMapPath"  description="SiteMapPath Example" />
      <siteMapNode url="TreeViewExample.aspx" title="TreeView"  description="TreeView Example" />
    </siteMapNode>
  </siteMapNode>
</siteMap>






No comments:

Post a Comment