title: Conditional Anchors
body: <p>I have a website in which I need to have conditional navigation. As such:</p>
  
  <p>Clicked item in Menu</p>
  
  <p>1: if frontpage, go to #id </p>
  
  <pre><code>(example &lt;a href="#events"&gt;) 
  </code></pre>
  
  <p>2: if subpage, go to front- or other subpage </p>
  
  <pre><code>(example &lt;a href="../events/&gt;)
  </code></pre>
  
  <p>The website is a .net website and the navigation is located on the masterpage.</p>
  
  <p>I have thought of different ways to solve this, either with <strong>.Net &amp; C#, JS or JQuery.</strong>
  In .Net I thought I could assign asp controls and simply serve different links in different subpages and then have some sort of loop or replacement with the codebehind.</p>
  
  <p>If anyone has any idea how to figure out this, please write. Thanks in advance!</p>
  
  <p>Code examples:</p>
  
  <pre><code>&lt;li&gt;
  &lt;a href="&lt;%--../coaching/--%&gt;#Coaching" title="title text"&gt;Coaching &amp; Consulting&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>