Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is it possible to add an active class to a link based on a querystring?
So in a normal navigation you might have something like:
@foreach (var page in root.DescendantsOrSelf().Where("Visible")) { <a href="@page.Url" class="@page.IsEqual(Model, "active", "")" >@page.Name</a> }
Could I do something similar, but based on a queryString – in this case eventDistance:
<a href="@Model.Url?eventDistance=@distName" class="distance-link">@distName</a>
The QueryString could match:
Thanks in advance.
Something like this should do it ;)
@(Request.QueryString["something"] == "something" ? "yeah" : "noes")
Brilliant – thank you so much :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Can you have active classes based on QueryStrings
Is it possible to add an active class to a link based on a querystring?
So in a normal navigation you might have something like:
Could I do something similar, but based on a queryString – in this case eventDistance:
The QueryString could match:
Thanks in advance.
Something like this should do it ;)
Brilliant – thank you so much :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.