Site Map Path
The SiteMapPath control basically is used to access web pages of the website from one webpage to another. It is a navigation control and displays the map of the site related to its web pages. This map includes the pages in the particular website and displays the name of those pages. You can click on that particular page in the Site Map to navigate to that page. We can say that the SiteMapPath control displays links for connecting to URLs of other pages. The SiteMapPath control uses a property called SiteMapProvider for accessing data from databases and it stores the information in a data source. The SiteMapProvider internally utilizes the SiteMapProvider abstract class defined under the System.Web namespace. The representation of the SiteMapPath control is as follows:
1. First you create your master page and then drag to the master page of SiteMapPath control.
2. Master page have you create menu that show the navigate process to the another page.
3. Master page inherit all the web pages that you have created in your web application.
4. Last you Add web.sitmap XML file in your web application that have link all web form which you are created in your application.
web.sitmap
<?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="">
<siteMapNode url="~/TimerAjax.aspx" title="TimerAjax" description="" />
<siteMapNode url="~/TriggerAjax.aspx" title="TriggerAjax" description="" />
<siteMapNode url="~/UpdateProgress.aspx" title="UpdateProgressAjax" description="" />
<siteMapNode url="~/UpdtProgress.aspx" title="UpdtProgressAjax" description="" />
<siteMapNode url="~/SiteMapPath.aspx" title="SiteMapPath" description="" />
</siteMapNode>
</siteMap>
MasterPage.master
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<head id="head1" runat="server">
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
height: 429px;
}
.auto-style3 {
height: 22px;
}
</style>
</head>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td colspan="2">
<asp:Image ID="Image1" runat="server" Height="103px" ImageUrl="~/Images/banner_1.gif" Width="100%" />
</td>
</tr>
<tr>
<td class="auto-style3">
<asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" Font-Size="X-Small" OnItemCreated="SiteMapPath1_ItemCreated" PathSeparator=" : ">
<CurrentNodeStyle ForeColor="#333333" />
<NodeStyle Font-Bold="True" ForeColor="#990000" />
<PathSeparatorStyle Font-Bold="True" ForeColor="#990000" />
<RootNodeStyle Font-Bold="True" ForeColor="#FF8000" />
</asp:SiteMapPath>
</td>
<td class="auto-style3">
<asp:Menu ID="Menu1" runat="server" BackColor="#FFFBD6" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" StaticSubMenuIndent="10px">
<DynamicHoverStyle BackColor="#990000" ForeColor="White" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicMenuStyle BackColor="#FFFBD6" />
<DynamicSelectedStyle BackColor="#FFCC66" />
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home" Value="Home">
<asp:MenuItem NavigateUrl="~/TimerAjax.aspx" Text="TimerAjax" Value="TimerAjax"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/TriggerAjax.aspx" Text="TriggerAjax" Value="TriggerAjax"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/UpdateProgress.aspx" Text="UpdateProgress" Value="UpdateProgress"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/UpdtProgress.aspx" Text="UpdtProgress" Value="UpdtProgress"></asp:MenuItem>
</asp:MenuItem>
</Items>
<StaticHoverStyle BackColor="#990000" ForeColor="White" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticSelectedStyle BackColor="#FFCC66" />
</asp:Menu>
<siteMapNode url="UpdtProgress.aspx" title="UpdtProgressAjax" description="" />
</td>
</tr>
<tr>
<td class="auto-style2" colspan="2">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td style="text-align: center" colspan="2">© Created By PKS</td>
</tr>
</table>
</form>TimerAjax.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TimerAjax.aspx.cs" Inherits="TimerAjax" MasterPageFile="~/MasterPage.master" %>
<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">
<table bgcolor="Silver" class="style1" style="margin-left: 404px">
<tr>
<td class="style2" style="width: 517px">
<asp:Timer ID="Timer1" runat="server" Interval="3000" OnTick="Timer1_Tick">
</asp:Timer>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Label ID="lblMsg" runat="server" Font-Bold="True" ForeColor="Maroon"></asp:Label>
</td>
</tr>
</table>
</asp:Content
0 comments
Post a Comment