473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

menu question

Hi Guys.
I am currently having a problem with my menu control. The requirement for
menu is. All root menuitems will be displayed as images. The image for each
root menuitem will be different. All the child menuitems are normal text.
Previously, I just a customized ajax menu control, which works fine. But my
boss think the menu should be a non-javascript menu(some users might disable
the javascript). So I have to switch the menu to css base. I'd like to use
the stardard menu control plus CSS Control Adapter Toolkit for asp.net 2.0.
But I haven't found a way to display all my root menu items as images (not
as background).

Is there a way for me to achieve what I want? Can anyone give me some clue
how to do this?

Cheers
Victor
Aug 13 '07 #1
5 1468
Hi Victor,

Are you using a Sitemap DataSource for your Menu control? If this is the
case, then you can use following article as a reference:

http://aspnet.4guysfromrolla.com/articles/030806-1.aspx

Basically it adds imageUrl in the data source and use it to set each node's
imageUrl in the DataBound event.

In your specific case, since you're only setting imageUrl for root nodes
and no text is needed for them:

protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
{
SiteMapNode node = (SiteMapNode)e.Item.DataItem;
if (e.Item.Parent == null)
{
if (node["imageUrl"] != null)
{
e.Item.ImageUrl = System.IO.Path.Combine("~/images/",
node["imageUrl"]);
}
e.Item.Text = "";
}
}
The above event will first get the SiteMapNode that is being bound to the
MenuItem and check if it's a root node (Parent == null), then read from the
datasource to set the imageUrl and remove Text.

If you're using other data sources, the code will need some change but the
idea is the same.

Please feel free to let me know if this helps or not.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 13 '07 #2
Hi Victor,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 16 '07 #3
Hi Walter:
have you finished the code I sent you yesterday? Can you tell me where I did
wrong so that my menu does not work in the IE6?

Cheers
Victor

""Walter Wang [MSFT]"" <wa****@online.microsoft.comwrote in message
news:Zu*************@TK2MSFTNGHUB02.phx.gbl...
Hi Victor,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 16 '07 #4
Hi Victor,

Yes I've just debugged the code.

Based on my understanding, you once mentioned that you need to make the CSS
based menu work when browser disabled javascript, therefore I can see you
removed the javascript related code from the MenuAdapter.cs in your code.

Unfortunately, if you take a look at the original code of MenuAdapter.js
from the CSS adapter template:

if (isPreIE7)
{
window.onload = SetHover__AspNetMenu;
}
Due to IE6 doesn't fully support some CSS standards, we have to use some
javascript to make the CSS rules work in pre-IE7 version. Since you removed
this javascript, that's why it now only works in IE7.

I'm afraid there's no other workaround for this issue, after all, it's
already a workaround to make the CSS adapters fully work in IE6. Sorry for
the inconvience caused.

Can you tell me more about your requirement, design, etc.? Maybe we can
fallback to other workarounds when there's no javascript support.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 16 '07 #5
Hi Walter:
Yes you are right. The problem is caused by IE6 doesnt support the full css.
So I added the javascript into my code then it works. :)
Thanks a lot.

Victor

""Walter Wang [MSFT]"" <wa****@online.microsoft.comwrote in message
news:PW****************@TK2MSFTNGHUB02.phx.gbl...
Hi Victor,

Yes I've just debugged the code.

Based on my understanding, you once mentioned that you need to make the
CSS
based menu work when browser disabled javascript, therefore I can see you
removed the javascript related code from the MenuAdapter.cs in your code.

Unfortunately, if you take a look at the original code of MenuAdapter.js
from the CSS adapter template:

if (isPreIE7)
{
window.onload = SetHover__AspNetMenu;
}
Due to IE6 doesn't fully support some CSS standards, we have to use some
javascript to make the CSS rules work in pre-IE7 version. Since you
removed
this javascript, that's why it now only works in IE7.

I'm afraid there's no other workaround for this issue, after all, it's
already a workaround to make the CSS adapters fully work in IE6. Sorry for
the inconvience caused.

Can you tell me more about your requirement, design, etc.? Maybe we can
fallback to other workarounds when there's no javascript support.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
1
by: Marc | last post by:
Hi I have a system wide hook that detects menus with class(#32768). Is it possible to detect if a menu is a sub-menu of another? I currently have the handle(HWND) to the menu I am interested...
4
by: Chris45 | last post by:
Hi , Trying to get a menu working for sometime now have wasted money on stupid software etc.Now have been trying out a freebee from www.dynamicdrive.com, but have one or two question. It's...
12
by: MP Multimedia | last post by:
Hello everyone, I need help. I'm using a hierarchical menu made in javascript. When I used it in a one frame page, it came out fine. But now I need to change my page to 3 frames: a top frame,...
2
by: Rob McLennan - ZETLAND | last post by:
Hi, I have set up an external stylesheet, named "print.css", to format the style of all pages printed from my company's website. I've been previewing my changes to the stylesheet by doing...
2
by: Mark Preston | last post by:
Its perhaps a bit early to ask, since I'm still doing the page design and haven't got down to the coding yet, but I wonder if anyone can help with a bit of a question. To lay the groundwork, a...
4
by: Aaron Queenan | last post by:
How can I use the designer to add a context menu to a class which inherits from a control, e.g. treeview, without adding the context menu to a form? For example, to add a context menu with...
2
by: Sisnaz | last post by:
I'm working with 2005 Beta 2 and I'm sure this is a trivial question but for the life of me I can't figure out. I placed a menu navigation componet on my master page and defined the navigation...
10
by: sk | last post by:
Hi everyone, I'm kind of new to C programming, so I thought that a newsgroup would be the best place to ask a question about this. I'm trying to write a small program that displays a menu and has...
1
by: Preeti | last post by:
Hi all I am a fresher and have been given a requirement in VB.net I have to make an application in VB.net which will run as a system tray icon and will add one or two items in the default...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.