CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > microsoft_downloads.css_friendly_control_adapters Tags:
Item Type: Date Entered: 1/31/2008 11:12:59 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 3 Views: 88 Favorited: 0 Favorite
4 Items, 1 Pages 1 |< << Go >> >|
"haljan" <>
NewsGroup User
Modify Menu adapter to show selected <ul> element1/31/2008 11:12:59 PM

0

Hey, I need some help modifying the menu adapter code to give child <ul> elements a class value indicating that the parent is selected. It should render like this:

 

< ul class="AspNet-Menu">
	< li class="AspNet-Menu-WithChildren  AspNet-Menu-ChildSelected">
		< a href="/rockit/admin/Default.aspx" class="AspNet-Menu-Link  AspNet-Menu-ChildSelected">
		< span>Mypage< /span>< /a>
			< ul class="AspNet-Sub AspNet-Sub-Selected">
				< li class="AspNet-Menu-Leaf  AspNet-Menu-Selected">
					< a href="/rockit/admin/Default2.aspx" class="AspNet-Menu-Link  AspNet-Menu-Selected">
					< span>Test< /span>< /a>
				< /li>
				< li class="AspNet-Menu-Leaf">
					< a href="/rockit/Default3.aspx" class="AspNet-Menu-Link">
					< span>Test2< /span>< /a>
				< /li>
			< /ul>
	< /li>
< /ul>
 I have already changed the code to render the span elements inside links, and giving child <ul> elements a class with value "AspNet-Sub". Only thing left that I can't figure out how to do is append a "AspNet-Sub-Selected" value to the child <ul> element containing a selected link. Hope this makes sense :)
"haljan" <>
NewsGroup User
Re: Modify Menu adapter to show selected <ul> element2/1/2008 1:37:41 AM

0

I want my menu to behave something like this: http://www.cssplay.co.uk/menus/simple_dropline.html

And the only way I can do that (I think) is getting the menu to show selected <ul> element 

"haljan" <>
NewsGroup User
Re: Modify Menu adapter to show selected <ul> element2/1/2008 3:50:16 PM

0

After a few hours of looking at the code I managed to get it to work.

"haljan" <>
NewsGroup User
Re: Modify Menu adapter to show selected <ul> element2/2/2008 2:13:16 AM

0

I'm posting my solution in case anyone else need help with something similar. It's not 100% perfect but it works :)

You can take a look at the result here: http://www.hallstensen.com/menuadapter/

This is only gonna work with a menu of maximum 2 tiers.

 Here's how to set it up:

1. ASPX file: 

<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1"
              Orientation="Horizontal"
              CssSelectorClass="nav" 
StaticDisplayLevels="2">
</asp:Menu>

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />

  2. Web.sitemap:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="Menu" description="">
<siteMapNode url="~/Default.aspx" title="Menu item 1" description="">
<siteMapNode url="~/pages/1/1-1.aspx" title="Test 1-1" description="" />
<siteMapNode url="~/pages/1/1-2.aspx" title="Test 1-2" description="" />
<siteMapNode url="~/pages/1/1-3.aspx" title="Test 1-3" description="" />
</siteMapNode>
<siteMapNode url="~/Default2.aspx" title="Menu item 2" description="">
<siteMapNode url="~/pages/2/2-1.aspx" title="Test 2-1" description="" />
<siteMapNode url="~/pages/2/2-2.aspx" title="Test 2-2" description="" />
</siteMapNode>
<siteMapNode url="~/Default3.aspx" title="Menu item 3" description="">
<siteMapNode url="~/pages/3/3-1.aspx" title="Test 3-1" description="" />
<siteMapNode url="~/pages/3/3-2.aspx" title="Test 3-2" description="" />
<siteMapNode url="~/pages/3/3-3.aspx" title="Test 3-3" description="" />
</siteMapNode>
<siteMapNode url="~/Default4.aspx" title="Menu item 4" description="">
<siteMapNode url="~/pages/4/4-1.aspx" title="Test 4-1" description="" />
<siteMapNode url="~/pages/4/4-2.aspx" title="Test 4-2" description="" />
<siteMapNode url="~/pages/4/4-3.aspx" title="Test 4-3" description="" />
<siteMapNode url="~/pages/4/4-4.aspx" title="Test 4-4" description="" />
</siteMapNode>
<siteMapNode url="~/Default5.aspx" title="Menu item 5" description="">
<siteMapNode url="~/pages/5/5-1.aspx" title="Test 5-1" description="" />
<siteMapNode url="~/pages/5/5-2.aspx" title="Test 5-2" description="" />
<siteMapNode url="~/pages/5/5-3.aspx" title="Test 5-3" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>

3. Style sheet: http://www.hallstensen.com/menuadapter/Style.txt

4. Modified MenuAdapter.cs: http://www.hallstensen.com/menuadapter/MenuAdapter.txt 

4 Items, 1 Pages 1 |< << Go >> >|


Free Download:













loginstatus does not sign out correct?

loginview can't dectect which role problem.

where to find access rules define with asp.net config tool

ftp error code 503 is it encryption?

security questions

formsauthentication question

outcache problem about login control!

new log-in controls

get standard implementation of sqlmembershipprovider

impersonation problem.

confirmation email sent to new users not containing correct information

proper way to set approve and/or lock of a user?

spezial web.config

password recovery control,mailbox unavailable error

server.transfer and enableviewstatemac

custom profile throwing database errors

users created in vs 2005 beta

"access is denied" error is thrown when trying to create a new directory

cookie domain naming problem

access denied

web.config not allowing me..

emergency help

when using createuserwizard, is sql server 2005 express needed?

filling up the aspnetdb from .csv file automatically

forms authentication using asp.net 2.0 documentation

enmuerate users

communicating to web application

v2 loginstatus | path to login.aspx

basic question about roles

ipostbackeventhandler permissions

authorization in asp.net

dynamic roles asp.net 2.0

wrong client credentials in windows-hosted wcf service called from asp.net

two providers required for user registration and profiles?

can the membershipinfo be extended? having a bit of trouble with that, and want to know if others succeeded before scrubbing it...

how to access user in role from external

how to restrict permissions on folder

asp.net 2.0 authentication

quick sessions & login question

enabling simple password

windows authentication

128 bit encryption

asp.net 2.0: how to deploy when using inbuilt security?

authenticating user from non-ad ldap server

eventlog on network machine

connectionstring security aspnet_regiis security effective?

login control in ie with host header

need help with datareader method

can not clear cookie form another application

manage user problem.

   
  Privacy | Contact Us
All Times Are GMT