More in this section
Forums / Developing with Sitefinity / Accessing custom field value through the Design/ Page Template

Accessing custom field value through the Design/ Page Template

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
1 posts, 0 answered
  1. Kristina
    Kristina avatar
    0 posts
    Registered:
    03 Apr 2017
    12 Apr 2017
    Link to this post

    Hi all, 

    I'm new to Sitefinity, and facing some minor problems with editing Page template.

    I've created custom Base template (.master in my VS) as a parent template for all other (Home, About us, etc) and imported it in the Sitefinity Backend. My goal is to add a little bit changed navigation widget, so I've added a custom field of type checkbox to the page template named "ActiveCb" and edited "Vertical with sublevels template" to add my own styling. Trying to access the value of that checkbox gives me the following error:

    DataBinding: 'Telerik.Sitefinity.Web.PageSiteNode' does not contain a property with the name 'ActiveCb'.

    Here's the code of the navigation widget template I'm adding to my Base page.

     

    <%@ Control Language="C#" %>
    <%@ Import Namespace="Telerik.Sitefinity.Web.UI.NavigationControls.Extensions.LightNavigationControlTemplate" %>
    <%@ Import Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" %>

    <%@ Register Assembly="Telerik.Sitefinity" TagPrefix="navigation" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" %>
    <%@ Register Assembly="Telerik.Sitefinity" TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" %>

    <navigation:SitefinitySiteMapDataSource runat="server" ID="dataSource" />


    <div class="nav columns-wrap">
        <sf:SitefinityLabel id="title" runat="server" WrapperTagName="h6" HideIfNoText="true" HideIfNoTextMode="Server" />

        <ul runat="server" id="navigationUl">
            <navigation:NavigationContainer ID="NavigationContainer1" runat="server" DataSourceID="dataSource">
                <Templates>
                      <navigation:NavigationTemplate>
                            <Template>
                              
                              <li class="<%# DataBinder.Eval(Container.DataItem,"ActiveCb").ToString().Equals("True")? "active":"none" %>"> 
                                    <a id="A1" class="link" runat="server" href='<%# NavigationUtilities.ResolveUrl(Container.DataItem) %>' target='<%# NavigationUtilities.GetLinkTarget(Container.DataItem) %>'><%# Eval("Title") %></a>          
                                    <ul id="Ul1" runat="server"></ul>
                                </li> 
                                           
                            </Template>
                          <SelectedTemplate>
                                <li>           
                                    <a id="A1" class="link" runat="server" href='<%# NavigationUtilities.ResolveUrl(Container.DataItem) %>' target='<%# NavigationUtilities.GetLinkTarget(Container.DataItem) %>'><%# Eval("Title") %></a>          
                                    <ul id="Ul1" runat="server"></ul>
                                </li>                                        
                            </SelectedTemplate>
                        </navigation:NavigationTemplate>
                    </Templates>
            </navigation:NavigationContainer>
        </ul>
    </div>

     

    Seems as thought the PageSiteNode is not aware of this new property. 

    Does anyone have an idea how to overcome this problem?

     

    Many thanks,

    Kris

1 posts, 0 answered