DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 13 Aug 2007 14:47:29 +1200,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Victor ail
          2    (Walter Wang [MSFT])
          3    (Walter Wang [MSFT])
                 4    Victor ail
                 5    (Walter Wang [MSFT])
                 6    Victor ail


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
Date:Mon, 13 Aug 2007 14:47:29 +1200   Author:  

RE: menu question   
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 (wawang@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.
Date:Mon, 13 Aug 2007 06:41:50 GMT   Author:  

RE: menu question   
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 (wawang@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.
Date:Thu, 16 Aug 2007 05:04:08 GMT   Author:  

Re: menu question   
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]""  wrote in message 
news:ZuSXnL83HHA.360@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 (wawang@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.
> 
Date:Thu, 16 Aug 2007 17:27:44 +1200   Author:  

Re: menu question   
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 (wawang@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.
Date:Thu, 16 Aug 2007 09:19:50 GMT   Author:  

Re: menu question   
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]""  wrote in message 
news:PWMpha%233HHA.2340@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 (wawang@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.
> 
Date:Mon, 20 Aug 2007 15:55:52 +1200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us