Presentppation on Sitemap Path Control

download Presentppation on Sitemap Path Control

of 30

Transcript of Presentppation on Sitemap Path Control

  • 7/29/2019 Presentppation on Sitemap Path Control

    1/30

    PRESENTATION ON

    SITEMAP PATH CONTROL

    CREATED BY:

    YUDHVIR SINGH(11B129)

  • 7/29/2019 Presentppation on Sitemap Path Control

    2/30

  • 7/29/2019 Presentppation on Sitemap Path Control

    3/30

    Introduction

    The SiteMapPath control basically is usedto access web pages of the website fromone webpage to another. It is a navigation

    control and displays the map of the siterelated to its web pages. This map includesthe pages in the particular website anddisplays the name of those pages. You canclick on that particular page in the Site Mapto navigate to that page. We can say thatthe SiteMapPath control displays links forconnecting to URLs of other pages.

  • 7/29/2019 Presentppation on Sitemap Path Control

    4/30

    Introduction (Cont)

    The SiteMapPath control uses a propertycalled SiteMapProviderfor accessing datafrom databases and it stores the informationin a data source. The SiteMapProviderinternally utilizes the SiteMapProviderabstract class defined under theSystem.Web namespace. The

    representation of the SiteMapPath control isas follows:

    Root Node->Child Node

  • 7/29/2019 Presentppation on Sitemap Path Control

    5/30

    Public Properties of SiteMapPath

    class:

    ParentLevelsDisplayed : It specifies the number oflevels of parent nodes and then displays the controlaccordingly related to the currently displayed node.

    RenderCurrentNodeAsLink : It specifies whetheror not the site navigation node that represents thecurrently displayed page is rendered as a hyperlink.

    PathSeperator : It specifies the string that displaysthe SiteMapPath nodes in the rendered navigationpath.

  • 7/29/2019 Presentppation on Sitemap Path Control

    6/30

    Style properties of the SiteMapPath

    class:

    CurrentNodeStyle : It specifies the styleused for the display text for the currentnode.

    RootNodeStyle : It specifies the style forthe root node style text.

    NodeStyle : It specifies the style used forthe display text for all nodes in the sitenavigation path.

  • 7/29/2019 Presentppation on Sitemap Path Control

    7/30

    Creating the SiteMapPath

    Control :

    Now lets create an application by

    using the SiteMapPath control. In this

    application we design the followingthree pages:

    The Home Page (Default.aspx)

    The First Page (myweb1.aspx)

    The Second page (myweb2.aspx)

  • 7/29/2019 Presentppation on Sitemap Path Control

    8/30

    Now we can use the SiteMapPath

    control using following steps:

    Step 1 : Open Microsoft Visual

    Studio.

    Step 2 : Select File->New->Web Site.

    Step 3 : Select ASP.NET Web Site

    and name it as mywebsite.

  • 7/29/2019 Presentppation on Sitemap Path Control

    9/30

    Steps.

    Step 4 : Add two web forms to theapplication named myweb1.aspx andmyweb2.aspx by performing the following

    steps: Move to the Solution Explorerwindow

    Right-click on the application name andselect the Add New Item option from the

    context menu

    Name the web form as myweb1.aspx andclick the Add button

  • 7/29/2019 Presentppation on Sitemap Path Control

    10/30

    Steps.

    Step 5 : Similarly add the myweb2.aspx webform to the application. After that we have to addthe Site Map file into the project. The Site Map fileis the XML file and has the extension .sitemap. Thesteps are as follows.

    Step 6 : Right-click the application in the SolutionExplorerwindow and then click the Add New Itemoption from the context menu.

    Step 7 : Select the SiteMap Template from theTemplates Pane. Note that, by default, the file hasthe name web.sitemap

  • 7/29/2019 Presentppation on Sitemap Path Control

    11/30

    Steps.

  • 7/29/2019 Presentppation on Sitemap Path Control

    12/30

    Steps.

    Step 8 : Now click the Add button to add the sitemap file to ourapplication.

    Step 9 : Now we can check that the sitemap file has been included inour project and we can see it in the Solution Explorer. And now wehave to set the URL and title attributes in the sitemap file.

  • 7/29/2019 Presentppation on Sitemap Path Control

    13/30

    Steps.

    Step 10 : Now Add one SiteMapPath control on the Default.aspx

    page from the navigation tab of the toolbox.

  • 7/29/2019 Presentppation on Sitemap Path Control

    14/30

    Steps.

    Step 11 : Add three labels and two hyperlink controls from

    the toolbox to the Default.aspx page and set the text property

    of the control.

  • 7/29/2019 Presentppation on Sitemap Path Control

    15/30

  • 7/29/2019 Presentppation on Sitemap Path Control

    16/30

    Steps.

    Step 13 : Now set the NavigateUrl Property of second hyperlink

    control and select myweb2.aspx file.

  • 7/29/2019 Presentppation on Sitemap Path Control

    17/30

    The source code of the Default.aspx

    page is as follows:



  • 7/29/2019 Presentppation on Sitemap Path Control

    18/30

    Continue..






    Click here to go to first page

    click here to go to secondpage

  • 7/29/2019 Presentppation on Sitemap Path Control

    19/30

    Steps.

    Step 14 : Now in the design mode of the

    myweb1.aspx page, add the same control

    but add only one hyperlink control and setits NavigateUrl property to myweb2.aspx

    then click ok.

  • 7/29/2019 Presentppation on Sitemap Path Control

    20/30

    The source code of the myweb1.aspx

    page is as follows:

  • 7/29/2019 Presentppation on Sitemap Path Control

    21/30

    Continue..





    click here to go to

    mywebpage2

  • 7/29/2019 Presentppation on Sitemap Path Control

    22/30

    Steps.

    Step 15 : Now in the design mode of

    the myweb2.aspx page, add the same

    controls as in myweb1.aspx and setthe NavigateUrl property of the

    hyperlink as Default.aspx then click

    ok.

  • 7/29/2019 Presentppation on Sitemap Path Control

    23/30

    The source code of myweb2.aspx is as

    follows:

  • 7/29/2019 Presentppation on Sitemap Path Control

    24/30

    Continue..

    Click here to go to Homepage

  • 7/29/2019 Presentppation on Sitemap Path Control

    25/30

    Steps.

    Step 16 : Now in the Solution Explorer window, right click on

    the Default.aspx page and select the Set As Start Page

    option.

  • 7/29/2019 Presentppation on Sitemap Path Control

    26/30

    Steps.

    Step 17: Press the F5 key to run the

    application

  • 7/29/2019 Presentppation on Sitemap Path Control

    27/30

    Output :

  • 7/29/2019 Presentppation on Sitemap Path Control

    28/30

    After clicking on the first link the output is as

    follows.

  • 7/29/2019 Presentppation on Sitemap Path Control

    29/30

    After clicking the link, the output of the second web

    page is as follows:

  • 7/29/2019 Presentppation on Sitemap Path Control

    30/30

    Thank You.