Developer forum

Forum » Templates » DwNavigation, but in Razor

DwNavigation, but in Razor

Daniel Williams
Reply

Hello,

In HTML templates we had the ability to write something like this:
<ul class="dwnavigation" id="mainNavigation">
  // This comment will be shown in the output
   <!--@DwNavigation-->
</ul>

- The smart thing about this, was to put content above and below this tag, and the content wasn't erased as it would if we did something like this:
<ul class="dwnavigation" id="mainNavigation">
  // This comment will NOT be shown in the output
</ul>

The Question is: How can we do this in Razor?


Replies

 
Nicolai Høeg Pedersen
Reply

You could add a  <!--@ DwNavigation(mainNavigation)--> to your layout. And you can do the same in Razor: @GetValue(mainNavigation).

 

<ul class="dwnavigation" id="mainNavigation">
// This comment will be shown in the output
@GetValue(mainNavigation)
</ul>
 
Mikkel Ricky
Reply
This post has been marked as an answer

Just to clarify: You have to write

<ul class="dwnavigation" id="mainNavigation">
  // This comment will be shown in the output
  @GetValue("DwNavigation(mainNavigation)")
</ul>

and you can use the same trick with a conten placeholder:

<div class="dwcontent" id="content-placeholder-id">
  // This comment will be shown in the output
  @GetValue("DwContent(contentplaceholderid)")
</div>

Note that all non-alphanumeric characters are stripped from the id used as the actual id (content-placeholder-id ⟼ contentplaceholderid).

Best regards,
Mikkel

Votes for this answer: 1

 

You must be logged in to post in the forum