This is a migrated thread and some comments may be shown as answers.

Setting a css class on items with empty NavigateUrl

1 Answer 84 Views
Menu
This is a migrated thread and some comments may be shown as answers.
RetoHell
Top achievements
Rank 1
RetoHell asked on 17 Mar 2009, 12:11 PM
Hi Telerik

We're building our Menu dynamically and we make use of the HighlighPath() method, everything works great.

Now some items do not have a NavigateUrl set, and we would like to assign a css class that shows just the default cursor, so everybody get's it that this element is not clickable.

I'm iterating through the items collection and mark empty items with a css class, but it does not work.

For Each item As RadMenuItem In RadMenu1.Items 
                If item.NavigateUrl = "" Then 
                    item2.CssClass = "rmLink rmDisabled" 
                End If 
Next 

I tried to set enable = false for those items too, but then childItems aren't visible anymore.

Thanks for your help in advance!
Tom

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Mar 2009, 06:41 AM
Hello Tom,

I tried following code for appliying style for RadMenuItem which does not have NavigateUrl set.

VB:
For Each item As RadMenuItem In RadMenu1.GetAllItems()  
    If String.IsNullOrEmpty(item.NavigateUrl) Then 
        item.CssClass = "MyClass" 
    End If 
Next 

CSS:
<style type="text/css">  
.MyClass  
{  
    backgroundnone !important;  
    color#999 !important;  
    cursor:default !important;  
}  
</style> 

Thanks,
Princy.
Tags
Menu
Asked by
RetoHell
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or