.net - Viewing model properties inside Umbraco template -


this should simple enough question having problems it, trying enable disable sidebar in umbraco template based on model's property.

<%@ master language="c#" masterpagefile="~/masterpages/master.master" autoeventwireup="true" %> <asp:content contentplaceholderid="maincontent" runat="server"> <umbraco:macro runat="server" language="cshtml"> @{     boolean enablesidebar = model.getproperty("enablesidebar").value; } <div class="container" style="margin-top:20px;">     <div class="row">         <div class="@(enablesidebar ? "span9" : "span12")">             <div class="default-content">                 <!-- content -->                 <asp:contentplaceholder runat="server" id="maincontent" />             </div>         </div>         @if (enablesidebar) {              <div class="span3 box">                 <div class="green-header-box"></div>                 <div class="inline box-content">                      <!-- sidebar -->                     <asp:contentplaceholder runat="server" id="sidebarcontent" />                 </div>             </div>         }     </div> </div> </umbraco:macro> </asp:content> 

i getting error says cannot use asp tags inside macro fine, not know how achieve same effect without using macro, can please me re-write properly?

i haven't used in-line macros before of thought of been like:

@{     if(model.enablesidebar) {         //dosomething     } } 

you need reference node on , property.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -