Logo

Navigation
  • Home
  • Services
    • ERP Solutions
    • Implementation Solutions
    • Support and Maintenance Solutions
    • Custom Solutions
    • Upgrade Solutions
    • Training and Mentoring
    • Web Solutions
    • Production Support
    • Architecture Designing
    • Independent Validation and Testing Services
    • Infrastructure Management
  • Expertise
    • Microsoft Development Expertise
    • Mobile Development
    • SQL Server Database and BI
    • SAP BI, SAP Hana, SAP BO
    • Oracle and BI
    • Oracle RAC
  • Technical Training
    • Learn Data Management
      • Business Intelligence
      • Data Mining
      • Data Modeling
      • Data Warehousing
      • Disaster Recovery
    • Learn Concepts
      • Application Development
      • Client Server
      • Cloud Computing Tutorials
      • Cluster Computing
      • CRM Tutorial
      • EDI Tutorials
      • ERP Tutorials
      • NLP
      • OOPS
      • Concepts
      • SOA Tutorial
      • Supply Chain
      • Technology Trends
      • UML
      • Virtualization
      • Web 2.0
    • Learn Java
      • JavaScript Tutorial
      • JSP Tutorials
      • J2EE
    • Learn Microsoft
      • MSAS
      • ASP.NET
      • ASP.NET 2.0
      • C Sharp
      • MS Project Training
      • Silverlight
      • SQL Server 2005
      • VB.NET 2005
    • Learn Networking
      • Networking
      • Wireless
    • Learn Oracle
      • Oracle 10g
      • PL/SQL
      • Oracle 11g Tutorials
      • Oracle 9i
      • Oracle Apps
    • Learn Programming
      • Ajax Tutorial
      • C Language
      • C++ Tutorials
      • CSS Tutorial
      • CSS3 Tutorial
      • JavaScript Tutorial
      • jQuery Tutorial
      • MainFrame
      • PHP Tutorial
      • VBScript Tutorial
      • XML Tutorial
    • Learn Software Testing
      • Software Testing Types
      • SQA
      • Testing
  • Career Training
    • Career Improvement
      • Career Articles
      • Certification Articles
      • Conflict Management
      • Core Skills
      • Decision Making
      • Entrepreneurship
      • Goal Setting
      • Life Skills
      • Performance Development
      • Personal Excellence
      • Personality Development
      • Problem Solving
      • Relationship Management
      • Self Confidence
      • Self Supervision
      • Social Networking
      • Strategic Planning
      • Time Management
    • Education Help
      • Career Tracks
      • Essay Writing
      • Internship Tips
      • Online Education
      • Scholarships
      • Student Loans
    • Managerial Skills
      • Business Communication
      • Business Networking
      • Facilitator Skills
      • Managing Change
      • Marketing Management
      • Meeting Management
      • Process Management
      • Project Management
      • Project Management Life Cycle
      • Project Management Process
      • Project Risk Management
      • Relationship Management
      • Task Management
      • Team Building
      • Virtual Team Management
    • Essential Life Skills
      • Anger Management
      • Anxiety Management
      • Attitude Development
      • Coaching and Mentoring
      • Emotional Intelligence
      • Stress Management
      • Positive Thinking
    • Communication Skills
      • Conversation Skills
      • Cross Culture Competence
      • English Vocabulary
      • Listening Skills
      • Public Speaking Skills
      • Questioning Skills
    • Soft Skills
      • Assertive Skills
      • Influence Skills
      • Leadership Skills
      • Memory Skills
      • People Skills
      • Presentation Skills
    • Finding a Job
      • Etiquette Tips
      • Group Discussions
      • HR Interviews
      • Interview Notes
      • Job Search Tips
      • Resume Tips
      • Sample Resumes
 

ASP.NET Advanced Site Functionality

By Exforsys | on September 16, 2005 |
ASP.NET 2.0

ASP.NET Advanced Site Functionality

In this tutorial you will learn advanced site functionality, Enhanced Page Framework, To create the Web.Sitemap file, Tracking Traffic with Site Counters and Going Mobile.

Enhanced Page Framework

The advanced functionalities offered by ASP.NET include site navigation and site counters. The built in navigation has three components:

1. Site Structure which is a programming interface that lists the hierarchical structure of the Website. The site map object exposes this interface using the components provided by the Site Map Provider. The default data store is usually a root level xml file named app.sitemap.

2. Site Navigation is a control that names each node defined in the site map and associates it with a URL.

3. Site Structure Display is a component that renders the site navigation user interface in an intelligent fashion and maps user friendly URLs to appropriate .aspx files.

The Site Map is a container for the hierarchical collection of nodes representing pages in an application. The default representation of a site map is Web.sitemap. This is an xml file.

To create the Web.Sitemap file:

1. Right click on the Website root folder and select Add New item…

2. Select a XmlFile and name it Web.sitemap

3. Open the file and add the following code to it.

  1. <siteMap>
  2. <siteMapNode title="Home" description="Home" url="~/default.aspx">
  3. <siteMapNode title="Courses" description="Our Courses"
  4.  url="~/Courses.aspx">
  5. <siteMapNode title="Web Application Development" description="Web Application Courses" url="~/webapp.aspx" />
  6. <siteMapNode title="Windows Application Development" description="Windows Application Courses"
  7. url="~/Winapp.aspx" />
  8. </siteMapNode>
  9. <siteMapNode title="Certifications" description="Certifications we offer" url="~/Certifications.aspx">
  10. <siteMapNode title="Training" description="Training classes"
  11.  url="~/Training.aspx" />
  12. <siteMapNode title="Microsoft" description="Microsoft certifications" url="~/Microsoft.aspx" />
  13. <siteMapNode title="Oracle" description="Oracle Certifications"
  14.  url="~/Oracle.aspx" />
  15. </siteMapNode>
  16. </siteMapNode>
  17. </siteMap>

4. Open the Default.aspx file and enter the following code to the page.

  1. <%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="Default_aspx" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  4. <script runat="server">
  5.     void Page_Load(object sender, EventArgs e)
  6.     {
  7.         InitSiteMap();
  8.     }
  9.     void InitSiteMap()
  10.     {
  11.         caption.Text = SiteMap.RootNode.Title;
  12.         foreach (SiteMapNode node in SiteMap.RootNode.ChildNodes)
  13.         {
  14.             ListItem LI = new ListItem();
  15.             LI.Text = node.Title;
  16.             LI.Value = node.Url;
  17.             MyLinks.Items.Add(LI);
  18.         }
  19.     }</script>
  20. <html xmlns="http://www.w3.org/1999/xhtml" >
  21. <head runat="server">
  22.     <title>Site Map</title>
  23. </head>
  24. <body>
  25.     <form id="form1" runat="server">
  26.     <asp:Panel Id= "MyPanel" runat="server"
  27.     backColor="#FFFFC0"
  28.     width="100%">
  29.     <h1> <asp:Label runat="server" ID="caption" valign="top" BackColor="#FFFFC0">ExForSys Site Map</asp:Label></h1>
  30.     </asp:Panel>
  31.     <table width="100%"><tr><td style="width:200;" bgcolor="lightcyan" valign="top">
  32.     <asp:BulletedList runat="server" ID="MyLinks" DisplayMode="HyperLink"  />
  33.     </td><td style="Width:10;" bgcolor="lightcyan"></td><td valign="top"> Content of the Page</td></tr></table>
  34.     <asp:SiteMapDataSource runat="server" ID="MySiteMap" />
  35.     <asp:TreeView runat="server" DataSourceID="MySiteMap">
  36.     <RootNodeStyle Font-Bold="true" />
  37.     <ParentNodeStyle Font-Bold="true" />
  38.     <NodeStyle Font-Size="0.8em" />
  39.     <DataBindings>
  40.     <asp:TreeNodeBinding NavigateUrlField="url" TextField="title" /></DataBindings>
  41.     </asp:TreeView>
  42.     <asp:Menu runat="server" DataSourceID="MySiteMap" />
  43.     </form>
  44. </body>
  45. </html>

5. Press F5 to execute the program. The output will look as under:

Let us examine what we have done in the above code. We have used a Panel control to define a header and put a label in it and we have added a BulletedList control to display the contents of the SiteMap.

Click here to view sample code

Then we have used a TreeView control to display the same information in a different format.

Click here to view sample code

Finally we have used a Menu control to display the same information.

< asp:Menu runat="server" DataSourceID="ExForSysSiteMap" / >

Another type of control that can be used to display the same information is the SiteMapPath control. This control displays a navigation path and shows the current user the place he is in and displays links to the Home page. The entire control can be deployed and bound to a data source without writing a single line of code. The SiteMapPath is customizable. The links will appear as: Home > Courses > Web Application Development. The user can navigate back and forth at higher or lower levels of the hierarchy using the SiteMapPath controls navigation features.

Tracking Traffic with Site Counters

Another advanced control provided by ASP.NET 2.0 for site enhancement is the Site Counter. This is extremely useful in monitoring visitor activity. The two types of site activity normally performed by visitors are Impression and ClickThrough. Impression is a viewing of some specific content while ClickThrough is a user’s click to see a specific content. The site counters provide means to track these activities and collects the read and write related activities to a database via an ad hoc provider. Counter data can be collected using page view counters and server counters such as Hyperlink and AdRotator.

For counters to work, the site counter service must be enabled in the configuration file in the site counters section. A database must be set up before they are used and finally the provider must be set up and connected to the related database using the Web Administration tool.

A hyperlink control configured to track clicks would be coded as under:

< asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="http://www.exforsys.com" Text="Visit us at ExForSys for the best tutorials" counterclicks="true" counterName="Exforsys.com" >< / asp:HyperLink >

Apart from accessing the counters declaratively it is possible to access the counters programmatically also. The Static members of the Site counter class can be used for reading and writing data in the site counters. The GetRows method returns a DataSet object filled with the site counter table.

Site counter providers include the AccessDataSource provider and the SQLDataSource Provider. ADO.NET classes are used to read and write onto the tables. Site counter tables are named aspnet_SiteCounters by default.

Going Mobile

ASP.NET 1.x used the Microsoft Mobile Toolkit to code for mobile devices. In ASP.NET 2.0 all controls have a mobile interface. The infrastructure of the server control are now built on a control adapter architecture. There is an adapater for each device and the number of adapters can be added. Since the controls are derived from the adapters no special action is required to be performed. The adapter renders the control intelligently to the device.

The following code is a sample of the code for a nokia device.

< asp:Label id="MyLabel" runat="server"
Text="Welcome ExForSys.com"
Nokia:Text="Time to upgrade your Nokia phone!"
cssClass="StandardStyleClass"
Nokia:cssClass="SpecialNokiaStyleClass" / >

The Mechanisms help developers override the built in rendering for mobile devices and provide automatic support with standard controls. However there are some controls which are specifically built for mobile devices. For instance the PhoneLink and Pager controls are exclusively for mobile devices.

It is clear that the direction of development of Web application development is the creation of a seamless, supportive, codeless environment that helps rapid application development and ease of deployment.

« « ASP.NET : Dynamic Image control
Oracle Apps 11i : Creating Journals through Oracle GL » »

Author Description

Avatar

Editorial Team at Exforsys is a team of IT Consulting and Training team led by Chandra Vennapoosa.

Free Training

RSSSubscribe 394 Followers
  • Popular
  • Recent
  • ASP.NET – Adding Web Parts at Run Time

    August 22, 2005 - 0 Comment
  • Getting started with ASP.NET 2.0

    July 4, 2005 - 0 Comment
  • ASP.NET Data Source Object Model

    September 6, 2005 - 0 Comment
  • ASP.NET Referencing Master Page Members

    August 17, 2005 - 0 Comment
  • ASP.NET : Dynamic Image control

    September 16, 2005 - 0 Comment
  • ASP.NET Personalization: User Profiles and Themes

    August 23, 2005 - 0 Comment
  • Introduction to Visual Studio.NET

    July 26, 2005 - 0 Comment
  • ASP.NET SqlDataSource Control

    September 6, 2005 - 0 Comment
  • ASP.NET Changing Master Pages Dynamically

    August 18, 2005 - 0 Comment
  • ASP.NET Data Access features

    August 27, 2005 - 0 Comment
  • Application Development in .NET

    November 21, 2007 - 0 Comment
  • ASP.NET : Dynamic Image control

    September 16, 2005 - 0 Comment
  • ASP.NET Creating Web Wizards

    September 16, 2005 - 0 Comment
  • Displaying Master-Detail Data on Separate Pages in ASP.NET

    September 16, 2005 - 0 Comment
  • ASP.NET Displaying Master-Detail Data on the Same Page

    September 13, 2005 - 0 Comment
  • ASP.NET DataBound Controls – Details View

    September 13, 2005 - 0 Comment
  • ASP.NET Using a Grid to Display Detail Information

    September 13, 2005 - 0 Comment
  • ASP.NET Adding Sorting and Paging in GridView

    September 10, 2005 - 0 Comment
  • ASP.NET GridView Filtering

    September 10, 2005 - 0 Comment
  • ASP.NET GridView Control

    September 10, 2005 - 0 Comment

Exforsys e-Newsletter

ebook
 

Related Articles

  • Application Development in .NET
  • ASP.NET : Dynamic Image control
  • ASP.NET Creating Web Wizards
  • Displaying Master-Detail Data on Separate Pages in ASP.NET
  • ASP.NET Displaying Master-Detail Data on the Same Page

Latest Articles

  • Project Management Techniques
  • Product Development Best Practices
  • Importance of Quality Data Management
  • How to Maximize Quality Assurance
  • Utilizing Effective Quality Assurance Strategies
  • Sitemap
  • Privacy Policy
  • DMCA
  • Trademark Information
  • Contact Us
© 2023. All Rights Reserved.IT Training and Consulting
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptReject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT