Note that there are some explanatory texts on larger screens.

plurals
  1. POC# .NET Website - adding a CSS class to menu elements
    primarykey
    data
    text
    <p>I've been using PHP for 7 years or so now, but as of today I've been thrust into using .NET for a project. Just for an insite:</p> <p>This project features:</p> <p>.NET4 Viewstate = false</p> <p>Now my issue is this. The main layout is covered by the master page which seems quiet obvious how it works. It also includes nav menu options such as:</p> <pre><code>&lt;div id="menu"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="default.aspx" title="Home" &gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="products.aspx" title="Products"&gt;Products&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="prices.aspx" title="Size &amp;amp; Price"&gt;Size &amp;amp; Price&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="formats.aspx" title="File Formats"&gt;File Formats&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Now what I would like to do would be to add a CSS class attribute depending on what page I'm on so if I was on the products page I'd get the following source:</p> <pre><code>&lt;div id="menu"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="default.aspx" title="Home" &gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="products.aspx" class="active" title="Products"&gt;Products&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="prices.aspx" title="Size &amp;amp; Price"&gt;Size &amp;amp; Price&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="formats.aspx" title="File Formats"&gt;File Formats&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Any help would be greatly appreciated!</p> <p>Cheers :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload