<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7162519108473858796</id><updated>2024-09-14T08:58:57.419-07:00</updated><title type='text'>Create Custom Navigation for SharePoint:AspMenu</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sharepoint2010customnavigation.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7162519108473858796/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sharepoint2010customnavigation.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Bhavin Prajapati</name><uri>http://www.blogger.com/profile/05741545840620919410</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoBdek6uE454iXBVizY5PtVDrovNnKqRtry6e0H-59jo4C0JMksuFburzMPLW23M1uMzyNt57pAkTT-Lrrj59DLf8CWILYNSx7bvZcPeZwsT2i1ezfBbHOCwlEjL8spvk/s220/16.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7162519108473858796.post-2886369252465911971</id><published>2011-05-25T08:56:00.000-07:00</published><updated>2012-06-20T17:57:14.734-07:00</updated><title type='text'>Create Custom Navigation for SharePoint:AspMenu using a asp:Repeater</title><content type='html'>As you are probably aware, there are many different ways to create a  navigation in Sharepoint 2010. This blog will focus on ONE specific way  that is both easy and powerful. I will show you how to create a left  navigation without overwhelming readers with loads of information they  don&#39;t need and can probably figure out on their own.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #3333ff; font-weight: bold;&quot;&gt;1)&lt;/span&gt; Create the menu hierarchy in site settings.&lt;br /&gt;
Go to Site Actions &amp;gt; Site Settings &amp;gt; Navigation&lt;br /&gt;
Create all the menu entries and sub-entries that you need for your menu.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #3333ff; font-weight: bold;&quot;&gt;2)&lt;/span&gt;  In the master page, there should be a node for the SharePoint:AspMenu. It should look something like the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;                    &amp;lt;!-- top navigation publishing data source --&amp;gt;
                  &amp;lt;PublishingNavigation:PortalSiteMapDataSource
                      ID=&quot;topSiteMap&quot;
                      runat=&quot;server&quot;
                      EnableViewState=&quot;false&quot;
                      SiteMapProvider=&quot;GlobalNavigation&quot;
                      StartFromCurrentNode=&quot;true&quot;
                      StartingNodeOffset=&quot;0&quot;
                      ShowStartingNode=&quot;false&quot;
                      TrimNonCurrentTypes=&quot;Heading&quot;/&amp;gt;
                   
                  &amp;lt;!-- top navigation menu (set to use the new Simple Rendering)
                  &amp;lt;SharePoint:AspMenu
                    ID=&quot;TopNavigationMenuV4&quot;
                    EncodeTitle=&quot;false&quot;
                    Runat=&quot;server&quot;
                    EnableViewState=&quot;true&quot;
                    DataSourceID=&quot;topSiteMap&quot;
                    AccessKey=&quot;&amp;lt;%$Resources:wss,navigation_accesskey%&amp;gt;&quot;
                    UseSimpleRendering=&quot;true&quot;
                    UseSeparateCss=&quot;True&quot;
                    Orientation=&quot;Vertical&quot;
                    StaticDisplayLevels=&quot;2&quot;
                    MaximumDynamicDisplayLevels=&quot;2&quot;
                    SkipLinkText=&quot;&quot;
                    CssClass=&quot;s4-tn&quot;&amp;gt;
                   &amp;lt;/SharePoint:AspMenu&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
It is not easy to apply custom styling to this and even the styling capabilities it has is limited.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #3333ff; font-weight: bold;&quot;&gt;3) &lt;/span&gt;In  order to apply custom styling, we will use asp:Repeater to dynamically  generate the desired html/css code. The following code can &lt;span style=&quot;font-style: italic;&quot;&gt;replace only the SharePoint:AspMenu&lt;/span&gt;  and should allow you create whatever html/css code you need for  styling. This is a two level navigation where each main header can have  multiple children. This can be specified in the Navigation site  settings.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;                        &amp;lt;asp:Repeater runat=&quot;server&quot; ID=&quot;MenuRepeater&quot; DataSourceID=&quot;topSiteMap&quot;&amp;gt;
                           &amp;lt;HeaderTemplate&amp;gt;&amp;lt;div class=&quot;arrowlistmenu&quot;&amp;gt;&amp;lt;/HeaderTemplate&amp;gt;
                           &amp;lt;SeparatorTemplate&amp;gt;&amp;lt;img src=&quot;images/eOne_leftmenu_divider.gif&quot; height=&quot;2&quot; width=&quot;164&quot; /&amp;gt;&amp;lt;/SeparatorTemplate&amp;gt;
                           &amp;lt;ItemTemplate&amp;gt;&amp;lt;h3 class=&quot;menuheader expandable&quot;&amp;gt;&amp;lt;a href=&quot;&amp;lt;%# Eval(&quot;Url&quot;)%&amp;gt;&quot;&amp;gt;&amp;lt;%# Eval(&quot;Title&quot;)%&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;
                           &amp;lt;asp:Repeater runat=&quot;server&quot; ID=&quot;ChildMenuRepeater&quot; DataSource=&#39;&amp;lt;%# ((SiteMapNode)Container.DataItem).ChildNodes %&amp;gt;&#39;&amp;gt;
                              &amp;lt;HeaderTemplate&amp;gt;&amp;lt;ul class=&quot;categoryitems&quot;&amp;gt;&amp;lt;/HeaderTemplate&amp;gt;
                              &amp;lt;ItemTemplate&amp;gt;
                              &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&amp;lt;%# Eval(&quot;Url&quot;)%&amp;gt;&quot;&amp;gt;&amp;lt;%# Eval(&quot;Title&quot;)%&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
                              &amp;lt;/ItemTemplate&amp;gt;
                              &amp;lt;FooterTemplate&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/FooterTemplate&amp;gt;
                          &amp;lt;/asp:Repeater&amp;gt;
                           &amp;lt;/ItemTemplate&amp;gt;
                       
                           &amp;lt;FooterTemplate&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/FooterTemplate&amp;gt;
                       &amp;lt;/asp:Repeater&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
I will now explain some of the template elements in the asp:Repeater.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;HeaderTemplate   &lt;/span&gt;- Anything between these tags will be outputted ONCE before the repeater begins looping for the itemtemplate&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;SeparatorTemplate &lt;/span&gt;-Anything between these tags will be outputted between each item template&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;ItemTemplate &lt;/span&gt;-  Anything between these tags will be applied for EACH element in the  source data, in this case out navigation entries. Further more, you can  use another repeater inside this to output the sub-entries as shown in  the code above.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;FooterTemplate &lt;/span&gt;- Anything between these tags will be outputted ONCE after the item templates have outputted.&lt;br /&gt;
&lt;br /&gt;
I hope this tutorial have been helpful in creating a custom styled navigation for Sharepoint 2010.&lt;br /&gt;
&lt;br /&gt;
Please contact for feedback or questions.</content><link rel='replies' type='application/atom+xml' href='http://sharepoint2010customnavigation.blogspot.com/feeds/2886369252465911971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sharepoint2010customnavigation.blogspot.com/2011/05/create-custom-navigation-for.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7162519108473858796/posts/default/2886369252465911971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7162519108473858796/posts/default/2886369252465911971'/><link rel='alternate' type='text/html' href='http://sharepoint2010customnavigation.blogspot.com/2011/05/create-custom-navigation-for.html' title='Create Custom Navigation for SharePoint:AspMenu using a asp:Repeater'/><author><name>Bhavin Prajapati</name><uri>http://www.blogger.com/profile/05741545840620919410</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoBdek6uE454iXBVizY5PtVDrovNnKqRtry6e0H-59jo4C0JMksuFburzMPLW23M1uMzyNt57pAkTT-Lrrj59DLf8CWILYNSx7bvZcPeZwsT2i1ezfBbHOCwlEjL8spvk/s220/16.JPG'/></author><thr:total>6</thr:total></entry></feed>