Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2006, 02:10 AM
Registered User
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Asp : Menu Control

hi i have used asp:Menu control in my master page and sitemap for datasource.Depending on the menu item clicked corresponding page loads. I changed the style of the selected menu item using StaticSelectedStyle attribute.But when i click on any button on that content page which loads another page the menu item style is changing to StaticMenuItemStyle. I want to show the style as StaticSelectedStyle.Kindly please help me..
 
Old November 28th, 2006, 06:19 PM
Friend of Wrox
 
Join Date: Feb 2006
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I doubt this is the most efficient way, but in your code behind, you can check the Request.RawUrl, and compare it to each treeview nodes NavigateUrl property one by one. Where they match, you set the nodes selected property to true...if anyone knows a more efficient way where you don't have to iterate through the nodes array, let me know!

Code:
Protected Sub trVw_DataBind(ByVal sender As Object, ByVal e As EventArgs) Handles trVw.DataBound

        For Each treeVwNode As TreeNode In trVw.Nodes

            If (treeVwNode.NavigateUrl = Request.RawUrl) Then
                treeVwNode.Selected = True
            End If

        Next

    End Sub
Neil Timmerman
Programmer
Veris Consulting





Similar Threads
Thread Thread Starter Forum Replies Last Post
Menu Navigation behind Control jwiedmier BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 March 19th, 2008 10:54 AM
ASP2.0 Menu Control SamuelP ASP.NET 2.0 Basics 2 December 12th, 2006 07:59 AM
Chapter 3 Menu Control ybai BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 June 30th, 2006 02:38 AM
Menu control ---images avats General .NET 3 July 6th, 2005 01:36 PM
menu control annieapple VS.NET 2002/2003 1 August 6th, 2003 10:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.