1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Rad Menu Items and CSS

Rad Menu Items and CSS

2 posts, 0 answered
  1. Sridhar Kamalakkannan
    Sridhar Kamalakkannan avatar
    2 posts
    Registered:
    09 Dec 2008
    11 Nov 2009
    Link to this post
    Hi there, I am implementing a RadMenu and dynamically generating RadMenuItems.

    Now I have assigned no CSSClass to my RadMenu control, however each of the items have a different css class assigned to them.

    Here is the code snippet

     

     

    1  
    2 <    private void BuildMenuFromCMSPageList(RadMenu rdMenu)  
    3     {  
    4  
    5         IList iCMSPageList = GetMenuNavigationPagesFromCMS();  
    6         IEnumerator iEnum = iCMSPageList.GetEnumerator();  
    7         while (iEnum.MoveNext())  
    8         {     
    9                 RadMenuItem rdMenuI = new RadMenuItem();  
    10                 ICmsPage iECurrentPage  = (ICmsPage)iEnum.Current;  
    11                 rdMenuI.CssClass = iECurrentPage.MenuName;  
    12                 rdMenuI.NavigateUrl = iECurrentPage.StaticUrl;  
    13  
    14                 rdMenu.Items.Add(rdMenuI);  
    15         }          
    16           
    17     }  
    18  

    Line 11 adds the cssclass to the menu item. The HTML generated is as follows

    1     <div id="navigation">  
    2         <dl id="dlTopNav" class="main-nav">  
    3             <dt>Audi site navigation</dt> 
    4                 <div id="mnuMainNavigation" class="RadMenu RadMenu_Default ">  
    5     <!-- 2009.1.410.35 --><ul class="rmHorizontal rmRootGroup">  
    6         <li class="rmItem rmFirst"><href="halloffame.aspx" class="rmLink halloffame"><span class="rmText"></span></a></li> 
    7  
    8 <li class="rmItem"><href="inspireNews.aspx" class="rmLink inspireNews"><span class="rmText"></span></a></li> 
    9  
    10 <li class="rmItem"><href="audiPoints.aspx" class="rmLink audiPoints"><span class="rmText"></span></a></li> 
    11  
    12 <li class="rmItem"><href="spend.aspx" class="rmLink spend"><span class="rmText"></span></a></li> 
    13  
    14 <li class="rmItem"><href="Programmes.aspx" class="rmLink programmes"><span class="rmText"></span></a></li> 
    15  
    16 <li class="rmItem"><href="home.aspx" class="rmLink home"><span class="rmText"></span></a></li> 
    17  
    18 <li class="rmItem"><href="login.aspx" class="rmLink login"><span class="rmText"></span></a></li> 
    19  
    20 <li class="rmItem rmLast"><href="BestPractice.aspx" class="rmLink Best Practice"><span class="rmText"></span></a></li> 
    21 </ul> 
    22 <input id="mnuMainNavigation_ClientState" name="mnuMainNavigation_ClientState" type="hidden" /> 
    23 </div> 
    24 </dl> 
    25  
    26 </div> 
    27  

    The CSS class is renamed to rmLink login (line 18) and so on for each of the menu items.
    How can I ensure that it is only login?

    Cheers
    Sridhar

     

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    11 Nov 2009
    Link to this post
    Hello Sridhar Kamalakkannan,

    These are two classes - class="rmLink login" . The first one is the same for all items and it comes from the embedded web resource form Telerik.Web.UI.dll

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered