Introduction smart navigation with Master Page in ASP.NET-Part 02

No.of Views719
Bookmarked0 times
Downloads 
Votes0
By  usamawahabkhan   On  05 Nov 2010 23:11:28
Tag : ASP.NET , Navigation Controls
In this article, I’m going to explain create smart navigation using master page in asp.net. this part has more tricks to manage navigation.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

1. Right Click EVOLUTIONPortal, click Add New Item… select Web Form and name it Home.aspx. Make sure Select master page check box is already checked, if not, check it and click Add.

2. Select EVOLUTIONCompanyMasterPage.master from Select a Master Page Dialog box.

3. Create more pages with the names dotNet.aspx, Management.aspx and database.aspx and link them to DotNetCourses.master, Management.master and databaseCourses.master respectively.

4. Open Home.aspx page in Source View and type the following in the Content Section

<p>
        This is the content section of Home Page which is .aspx page which is using EVOLUTIONCompanyMasterPage.master
        page. This site links you to all the sections and introduces you to EVOLUTION Courses
        like <a href="dotNet.aspx">Dot Net Coursesa> , <a href="Management.aspx">Management
            Coursesa> and <a href="database.aspx">Database Courses</a>.
    </p>
    <p>
        This site also introduces the <a href="Home.aspx">teachers</a> that teaches at EVOLUTION.</p>

5. Repeat Step No. 4 for other .aspx pages but write different contents in all of them. For example in dotNet.aspx write the following

<p>
        This is the content section of DotNet Courses Page which is .aspx page which is
        using DotNetCourses.master page. This page links you to all the courses offered
        in EVOLUTION and provides you the list of topics in each course offered. EVOLUTION
        is offered <a href="dotNet.aspx">Dot Net FrameWorka> , <a href="Management.aspx">Web
            Toolsa> and <a href="database.aspx">Windows Communication Foundation</a> to
        name a few.
    </p>
    <p>
        This site also introduces the <a href="Home.aspx">teachers</a> that teaches at EVOLUTION.</p>

6. Use your imagination to fill up other .aspx pages.

7. Notice that up till here, we have created all master pages, root pages for each section. Now we need to repeat the process of linking all these pages will treeView controls in every master page.

8. Open EVOLUTIONCompanyMasterPage.master, select Evolutiontree and set its ExpandDepth property to 0.

9. Now link every root page to each root node in Evolutiontree TreeView Control. Click Smart Tag of TreeView Control, click Edit Nodes… link, click Home and set its NavigateUrl property to Home.aspx by clicking the button just appeared against NavigateUrl Property.

10. Bind other root nodes (DotNet Courses, Project Management Courses, Database Courses) to their respective root (.aspx) pages.

11. Repeat step 8 to 10 for other (.master) pages.

12. Open Home.aspx page and write the following code inside the Page_Load Event

TreeView tv = (TreeView)Page.Master.FindControl("Evolutiontree"); 
tv.Nodes[0].Selected = true; 
tv.Nodes[0].ExpandAll();

13. Open dotNet.aspx, Management.aspx and database.aspx pages and paste the same code but every time change the number to its next value.

14. Create the rest of the required pages and make sure they link to each other properly. Also open dotnet.aspx page and now fix the links of Dot Net FrameWork, Web Tools and Windows Communication Foundation.

That's alll. i hope this is help to all.manage the good navigation with master page.

 
Sign Up to vote for this article
 
About Author
 
usamawahabkhan
Occupation-Not Provided
Company-Not Provided
Member Type-Senior
Location-Pakistan
Joined date-06 May 2010
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top