Answered Prevent SPAN tag in SharePoint Top Navigation Menu

  • יום חמישי 21 יוני 2012 07:04
     
      קוד כלול

    I am using Publishing Site with Global Navigation

    When I have seen the source code of page from browser.

    I have found menu item generated like

       <li class="static selected"> 
          <a id="slink" href="/sites/mySite/Tool/default.aspx" class="static selected menu-item"> 
          <span class="additional-background"> 
          <span class="menu-item-text">Tool</span></span></a>
       </li>
    

    I want to remove span tags from menu item

    final result should like given below

    <li class="static selected"> 
          <a id="slink" href="/sites/mySite/Tool/default.aspx" class="static selected menu-item"> 
          Tool
          </a>
       </li>
    
    can you please suggest anything (not custom menu)....


    Regards, Kashyap Patel http://interview-question-aspnet.blogspot.com

כל התגובות

  • יום שישי 22 יוני 2012 10:02
    מנחה דיון
     
     

    Hi,

    Thank you for your post.

    I'm trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks & Regards,
    Emir


    Emir Liu

    TechNet Community Support

  • שבת 23 יוני 2012 06:43
     
     

    Thanks Emir.


    Regards, Kashyap Patel http://interview-question-aspnet.blogspot.com

  • יום שני 25 יוני 2012 12:04
     
     

    I am sure you could use a script to remove this. But why are you trying to remove this?  The "additional-background" is used to show the dropdown arrow in the navigation. Also if you have a header without a link the text goes within the span tag.  These span tags actually can come in handy with custom designs.


    Heather Waterman SharePoint Branding and Desgin heatherwaterman.com @hwaterman

  • יום שלישי 26 יוני 2012 06:47
     
     תשובה

    Thanks Everyone,

    Finally solution found.

    This method is not best way to do this which I am going to mention

    1. Find Microsoft.SharePoint.dll
    2. Decomplile with Reflector.NET
    3. Find File from Microsoft > SharePoint > WebControls > aspmenu.cs
    4. Copy this file to the your custom library
    5. Customize method BuidDefaultInnerItem(MenuItem item, HtmlWriter writer, StringBulder className)
    6. remove span generation tags
    7. Rename Menu <{0}:aspmenu ..... to yours
    8. Change to the master page, add reference and enjoy....


    Regards, Kashyap Patel http://interview-question-aspnet.blogspot.com

    • סומן כתשובה על-ידי Kashyap Patel יום שלישי 26 יוני 2012 06:47
    •