The Navigation Controls are useful for maintaining the page hierarchy as well as the page navigation in ASP.Net. There are three navigation controls that one can use in ASP.Net 2.0 and above. These controls are:
The item marked as one shows the usage of the Menu Navigation control. The menu can be laid horizontal or vertical. In our example, the menu has the horizontal direction. Item marked as 2 in the example shows the TreeView Navigation Control and it shows the Navigational link and the hierarchical Relation between them. If you see here, the site groups the links under the country names. The items marked as 3 show the usage of the SiteMapPath Navigation Control. The path navigation control helps the user to know which page they are viewing. This is handy in a big site, and the user can know the path to that page from the top-level of the page. All these controls together express the usage of the navigational control on ASP.Net 2.0 and above.
Master Pages help in providing the consistently laid-out pages. When we switch between other pages, we can note the steady look and feel throughout the websites. Microsoft provides Master Page support from ASP.Net 2.0 onward. The Master Page is used to making the outer skeleton structure of the websites and we can see this outer skeleton as web page header, footer and sidebars with navigational elements. In this example, we will explore how to create a Master page along with other web pages.
When we start this example website, it first displays the home page. We can select a product and submit it to move to the Order Confirmation page. The order confirmation page has labels to provide order confirmation and the same page also has a link called ‘Home’ to navigate back to the homepage. From the homepage, we can navigate to the Web Admin Page where we can set the theme for the entire website. We can select a theme in the web admin page and apply that theme to the whole site (In our case it contains only three pages) by clicking the ‘apply’ button. From the web admin page, we can go to the main web page by using the home link.
All three pages use two themes named Ocean and Desert. By default, when we launch the site for the first time, we do not apply any theme. So we should go to the web admin page and from there we can apply a theme. The code behind in the web admin page uses the session variable for demo purpose. You should use application variables for real websites.
In this example, we will see how to make use of FormView Control of ‘Asp.Net to retrieve the data from the database. We will use SQLDataSource Control to supply the data for it. We will also look at modifying its Templates. This Control allows us to place the data-bound controls wherever we want. It is just like designing the form for calculating the Electricity Bill based on unit consumption. Now think of getting the table columns from the database and placing that freely on the web page wherever we want. This is achieved by the FormView Control.