title: ASP.Net Hide Left Hand Menu On Home Page
body: <p>I have an asp.net website which is having a left hand menu added to it and have hit an issue as I have found that I am doing a lot of code duplication (which is bad I know). What I want is for the left hand menu to be added to my Site.Master file rather than me having to add it to every single page.</p>
  
  <p>I can do this, but the left hand menu is then displayed on the "Home" page which I don't want so i was thinking that i need some sort of <code>IF</code> statement but I don't know how I can do this as I cant look at the URL as when the user hits the page its the standard naming (e.g. <a href="http://www.webaddress.co.uk/" rel="nofollow">http://www.webaddress.co.uk/</a>)</p>
  
  <p>My left hand menu is a scrolling <code>nav-stacked</code> which is working fine so I will also need to add the JQuery for this to the Site.Master I think.</p>
  
  <p><strong>Current HTML for my 'About Us' page</strong></p>
  
  <pre><code>&lt;asp:Content ID="AboutBodyContent" ContentPlaceHolderID="MainContent" runat="server"&gt;
      &lt;div class="col-sm-3 hidden-xs" style="padding-left: 0px"&gt;
          &lt;div class="follow-scroll"&gt;
              &lt;ul class="nav nav-stacked"&gt;
                  &lt;li&gt;&lt;a runat="server" href="~/"&gt;Home&lt;/a&gt;&lt;/li&gt;
                  &lt;li class="active"&gt;&lt;a runat="server" href="~/About"&gt;About&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a runat="server" href="~/Session/pg1"&gt;Session&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a runat="server" href="~/EmailPg"&gt;Email&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="col-xs-12 col-sm-9"&gt;
          &lt;h2&gt;&lt;%: Title %&gt;.&lt;/h2&gt;
          &lt;p&gt;Use this area to provide additional information.&lt;/p&gt;
          &lt;p&gt;Use this area to provide additional information.&lt;/p&gt;
          &lt;p&gt;Use this area to provide additional information.&lt;/p&gt;
      &lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
          (function ($) {
              var element = $('.follow-scroll'),
                  originalY = element.offset().top;
  
              // Space between element and top of screen (when scrolling)
              var topMargin = 75;
  
              // Should probably be set in CSS; but here just for emphasis
              element.css('position', 'relative');
  
              $(window).on('scroll', function (event) {
                  var scrollTop = $(window).scrollTop();
  
                  element.stop(false, false).animate({
                      top: scrollTop &lt; originalY
                              ? 0
                              : scrollTop - originalY + topMargin
                  }, 300);
              });
          })(jQuery);
      &lt;/script&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>The HTML code below is what I thought of for my Site.Master but as I said it needs to not be displayed on the "Home Page".</p>
  
  <pre><code>    &lt;div class="container body-content" style="padding-top: 25px"&gt;
          &lt;div class="container"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-xs-12"&gt;                            
                      &lt;div class="col-sm-3 hidden-xs" style="padding-left: 0px"&gt;
                          &lt;!-- 'IF' statement to go here so not displayed on Home page --&gt;
                          &lt;ul class="nav nav-stacked"&gt;
                              &lt;li&gt;&lt;a runat="server" href="~/"&gt;Home&lt;/a&gt;&lt;/li&gt;
                              &lt;li style="border-left: 1px solid lightgray"&gt;&lt;a runat="server" href="~/About"&gt;About&lt;/a&gt;&lt;/li&gt;
                              &lt;li style="border-left: 1px solid lightgray"&gt;&lt;a runat="server" href="~/Session/pg1"&gt;Session&lt;/a&gt;&lt;/li&gt;
                              &lt;li style="border-left: 1px solid lightgray"&gt;&lt;a runat="server" href="~/EmailPg"&gt;Email&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;
                      &lt;div class="col-xs-12 col-sm-9" style="padding-right: 0px"&gt;
                          &lt;asp:ContentPlaceHolder ID="MainContent" runat="server"&gt;&lt;/asp:ContentPlaceHolder&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;                    
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>