Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gibran Shah 69 posts 240 karma points
    Feb 17, 2019 @ 03:47
    Gibran Shah
    0

    Property alias not found when previewing page

    Hello,

    I'm getting the following error when I try to preview my page:

    error message

    The page is based on a document type with the following property:

    document type property

    I've search throughout my entire solution for files containing VIPCard and found two:

    .../AppData/Models/all.generated.cs .../AppData/Models/models.generated.cs

    I'm not sure if this is the right place to be looking, but in these files I find the follow code snippet (exactly the same in both):

    /// <summary>VIP Card</summary>
        [PublishedContentModel("vIPCard")]
        public partial class VIpcard : PublishedContentModel
        {
    
    ...
    
            ///<summary>
            /// Individual
            ///</summary>
            [ImplementPropertyType("dailyIndividual")]
            public decimal DailyIndividual
            {
                get { return this.GetPropertyValue<decimal>("dailyIndividual"); }
            }
    
    ...
    }
    

    Seems to be there (though I don't know what GetPropertyValue(...) is returning).

    Are these not the right files to be looking in?

    Anyone ever had this problem before?

    Thanks.

  • Tarik | WPPlumber 179 posts 801 karma points c-trib
    Feb 17, 2019 @ 10:38
    Tarik | WPPlumber
    0

    Gibran Shah, add more details by posting the code of the master template of that document type.

  • Chris Evans 137 posts 353 karma points c-trib
    Feb 17, 2019 @ 20:30
    Chris Evans
    1

    Hi Gibran,

    The property that Models Builder returns is case sensitive, and gets capitalised, so try referencing it like this:

    @Model.Content.DailyIndividual
    

    Notice the capital 'D'

    You could also obtain it via its alias through the api like:

    @Model.Content.GetPropertyValue<decimal>("dailyIndividual")
    

    Which is just what the Models Builder generated code is doing.

    Hope this helps!

    Chris

  • Gibran Shah 69 posts 240 karma points
    Feb 17, 2019 @ 21:48
    Gibran Shah
    0

    Hi Tarik,

    Thanks for the response.

    My templates look like this:

    templates

    My master template looks like this:

        <!DOCTYPE html>
        <html lang="en">
        <head>
    
        <!-- SITE TITTLE -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Holland and Barnes</title>
    
        <!-- PLUGINS CSS STYLE -->
        <link href="assets/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet">
        <link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <link href="assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
        <link href="assets/plugins/listtyicons/style.css" rel="stylesheet">
        <link href="assets/plugins/bootstrapthumbnail/bootstrap-thumbnail.css" rel="stylesheet">
        <link href="assets/plugins/datepicker/datepicker.min.css" rel="stylesheet">
        <link href="assets/plugins/selectbox/select_option1.css" rel="stylesheet">
        <link href="assets/plugins/owl-carousel/owl.carousel.min.css" rel="stylesheet">
        <link href="assets/plugins/fancybox/jquery.fancybox.min.css" rel="stylesheet" />
        <link href="assets/plugins/isotope/isotope.min.css" rel="stylesheet">
        <link href="assets/plugins/map/css/map.css" rel="stylesheet">
        <link href="assets/plugins/rateyo/jquery.rateyo.min.css" rel="stylesheet">
        <link href="assets/plugins/animate/animate.css" rel="stylesheet">
        <link href="" rel="stylesheet" id="bootstrap-rtl">
    
    
        <!-- GOOGLE FONT -->
        <link href="https://fonts.googleapis.com/css?family=Muli:200,300,400,600,700,800,900" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Herr+Von+Muellerhoff" rel="stylesheet">
    
        <!-- CUSTOM CSS -->
        <link href="assets/css/app.css" rel="stylesheet">
    
        <link rel="stylesheet" href="assets/css/default.css" id="option_color">
    
        <!-- FAVICON -->
        @*<link href="assets/img/favicon.png" rel="shortcut icon">*@
    
        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    
    </head>
    
        <body id="body" class="body-wrapper boxed-menu">
        <!-- <div class="page-loader" style="background: url(img/preloader.gif) center no-repeat #fff;"></div> -->
        <!-- Preloader -->
        <div id="preloader" class="smooth-loader-wrapper">
            <div class="smooth-loader">
                <div class="loader1">
                    <div class="loader-target">
                        <div class="loader-target-main"></div>
                        <div class="loader-target-inner"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="main-wrapper">
            <!-- HEADER -->
            <header id="pageTop" class="header">
    
                <!-- TOP INFO BAR -->
    
                <div class="nav-wrapper">
                    <!-- NAVBAR -->
                    <nav id="menuBar" class="navbar navbar-default transparent-navbar " role="navigation">
                        <div class="container">
    
                            <!-- Brand and toggle get grouped for better mobile display -->
                            <div class="navbar-header">
                                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                                    <span class="sr-only">Toggle navigation</span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                </button>
                                <a class="navbar-brand" href="index.html">
                                    <img style="margin-left: -15px;" src="~/assets/img/logo_bowtie_outline.png" />
                                </a>
                            </div>
    
                            <!-- Collect the nav links, forms, and other content for toggling -->
                            <div class="collapse navbar-collapse navbar-ex1-collapse">
                                <ul class="nav navbar-nav navbar-right" style="margin-right: 0px;">
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Ladies <i class="fa fa-angle-down" aria-hidden="true"></i></a>
                                        <ul class="dropdown-menu">
                                            <li><a class="" href="#">Ladies Only Service</a></li>
                                            <li><a class="" href="#">Hair Salon</a></li>
                                            <li><a class="" href="#">Dry Cleaning</a></li>
                                            <li><a class="" href="#">Spas</a></li>
                                            <li><a class="" href="#">Shopping</a></li>
                                            <li><a class="" href="#">Restaurants</a></li>
                                            <li><a class="" href="#">Art Galleries</a></li>
                                            <li><a class="" href="#">Golf Courses</a></li>
                                            <li><a class="" href="#">Lounges</a></li>
                                            <li><a class="" href="#">Car Rental</a></li>
                                            <li><a class="" href="#">Museums</a></li>
                                        </ul>
                                    </li>
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Gentlemen <i class="fa fa-angle-down" aria-hidden="true"></i></a>
                                        <ul class="dropdown-menu">
                                            <li><a class="" href="#">Restaurants</a></li>
                                            <li><a class="" href="#">Dry Cleaning</a></li>
                                            <li><a class="" href="#">Barbers</a></li>
                                            <li><a class="" href="#">Casinos</a></li>
                                            <li><a class="" href="#">Gentlemens Club</a></li>
                                            <li><a class="" href="#">Shoe Shine</a></li>
                                            <li><a class="" href="#">Spas</a></li>
                                            <li><a class="" href="#">Lounges</a></li>
                                            <li><a class="" href="#">Car Rental</a></li>
                                            <li><a class="" href="#">Golf Courses</a></li>
                                        </ul>
                                    </li>
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Couples <i class="fa fa-angle-down" aria-hidden="true"></i></a>
                                        <ul class="dropdown-menu">
                                            <li><a class="" href="#">Night Clubs</a></li>
                                            <li><a class="" href="#">Movie Theatres</a></li>
                                            <li><a class="" href="#">Shopping</a></li>
                                            <li><a class="" href="#">Spas</a></li>
                                            <li><a class="" href="#">Restaurants</a></li>
                                            <li><a class="" href="#">Tours</a></li>
                                            <li><a class="" href="#">Museums</a></li>
                                            <li><a class="" href="#">Comedy Clubs</a></li>
                                        </ul>
                                    </li>
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Alt Lifestyle <i class="fa fa-angle-down" aria-hidden="true"></i></a>
                                        <ul class="dropdown-menu">
                                            <li><a class="" href="#">G.F. Restaurants</a></li>
                                            <li><a class="" href="#">G.F. Lounges</a></li>
                                            <li><a class="" href="#">G.F. Night Clubs</a></li>
                                            <li><a class="" href="#">G.F. Shopping</a></li>
                                            <li><a class="" href="#">G.F. Restaurants</a></li>
                                            <li><a class="" href="#">G.F. Spas</a></li>
                                            <li><a class="" href="#">G.F. Accomodations</a></li>
                                        </ul>
                                    </li>
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Hotels</a>
                                    </li>
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">VIP Card</a>
                                    </li>
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Limo Service</a>
                                    </li>
                                    <li class="active dropdown singleDrop">
                                        <a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Airport Liason</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </nav>
                </div>
            </header>
    
    
            <main>
                @RenderBody()
            </main>
    
    
            <!-- FOOTER -->
            <footer>
                <!-- FOOTER INFO -->
                <div style="background-image: url(assets/img/background/bg-footer.jpg);">
                    <div class="clearfix footerInfo" style="background-image: url(assets/img/background/bg-footer.jpg);">
                        <div class="container">
                            <div class="row">
                                <div class="col-sm-7 col-xs-12">
                                    <div class="footerText">
                                        <a href="index.html" class="footerLogo">
                                            <img src="~/assets/img/logo_border.png" />
                                        </a>
                                        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor</p>
                                        <ul class="list-styled list-contact">
                                            <li><i class="fa fa-phone" aria-hidden="true"></i>[88] 657 524 332</li>
                                            <li><i class="fa fa-envelope" aria-hidden="true"></i><a href="#">[email protected]</a></li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="col-sm-3 col-xs-12">
                                    <div class="footerInfoTitle">
                                        <h4>Links</h4>
                                    </div>
                                    <div class="useLink">
                                        <ul class="list-unstyled">
                                            <li><a href="#">Ladies</a></li>
                                            <li><a href="#">Gentlemen</a></li>
                                            <li><a href="#">Couples</a></li>
                                            <li><a href="#">Alt Lifestyle</a></li>
                                            <li><a href="#">Hotels</a></li>
                                            <li><a href="#">VIP Card</a></li>
                                            <li><a href="#">Limo Service</a></li>
                                            <li><a href="#">Airport Liason</a></li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="col-sm-2 col-xs-12">
                                    <div class="footerInfoTitle">
                                        <h4>Company</h4>
                                    </div>
                                    <div class="useLink">
                                        <ul class="list-unstyled">
                                            <li><a href="#">Contact Us</a></li>
                                            <li><a href="#">Terms and Conditions</a></li>
                                            <li><a href="#">How It Works</a></li>
                                            <li><a href="#">Partners</a></li>
                                            <li><a href="#">Account Login</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- COPY RIGHT -->
                    <div class="clearfix copyRight">
                        <div class="container">
                            <div class="row">
                                <div class="col-xs-12">
                                    <div class="copyRightWrapper">
                                        <div class="row">
                                            <div class="col-sm-5 col-sm-push-7 col-xs-12">
                                                <ul class="list-inline socialLink">
                                                    <li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
                                                    <li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
                                                    <li><a href="#"><i class="fa fa-pinterest-p" aria-hidden="true"></i></a></li>
                                                    <li><a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
                                                </ul>
                                            </div>
                                            <div class="col-sm-7 col-sm-pull-5 col-xs-12">
                                                <div class="copyRightText">
                                                    <p>Copyright &copy; 2019. All Rights Reserved by <a href="http://hollandandbarnes.com/">Holland and Barnes</a></p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
    
                            </div>
                        </div>
                    </div>
                </div>
            </footer>
        </div>
    
        <!-- LOGIN  MODAL -->
        <div id="loginModal" tabindex="-1" class="modal fade" role="dialog">
            <div class="modal-dialog">
    
                <!-- Modal content-->
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Log In to your Account</h4>
                    </div>
                    <div class="modal-body">
                        <form class="loginForm">
                            <div class="form-group">
                                <i class="fa fa-envelope" aria-hidden="true"></i>
                                <input type="email" class="form-control" id="email" placeholder="Email">
                            </div>
                            <div class="form-group">
                                <i class="fa fa-lock" aria-hidden="true"></i>
                                <input type="password" class="form-control" id="pwd" placeholder="Password">
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary btn-block">Log In</button>
                            </div>
                            <div class="checkbox">
                                <label><input type="checkbox"> Remember me</label>
                                <a href="#" class="pull-right link">Fogot Password?</a>
                            </div>
    
                        </form>
                    </div>
                    <div class="modal-footer">
                        <p>Don’t have an Account? <a href="#" class="link">Sign up</a></p>
                    </div>
                </div>
            </div>
        </div>
    
        <!-- JAVASCRIPTS -->
        <script src="assets/plugins/jquery/jquery.min.js"></script>
        <script src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
        <script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
        <script src="assets/plugins/smoothscroll/SmoothScroll.min.js"></script>
        <script src="assets/plugins/waypoints/waypoints.min.js"></script>
        <script src="assets/plugins/counter-up/jquery.counterup.min.js"></script>
        <script src="assets/plugins/datepicker/bootstrap-datepicker.min.js"></script>
        <script src="assets/plugins/selectbox/jquery.selectbox-0.1.3.min.js"></script>
        <script src="assets/plugins/owl-carousel/owl.carousel.min.js"></script>
        <script src="assets/plugins/isotope/isotope.min.js"></script>
        <script src="assets/plugins/fancybox/jquery.fancybox.min.js"></script>
        <script src="assets/plugins/isotope/isotope-triger.min.js"></script>
        <script src="assets/plugins/rateyo/jquery.rateyo.min.js"></script>
        <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDU79W1lu5f6PIiuMqNfT1C6M0e_lq1ECY"></script>
        <script src="assets/plugins/map/js/rich-marker.js"></script>
        <script src="assets/plugins/map/js/infobox_packed.js"></script>
        <script src="assets/js/map.js"></script>
        <script src="assets/js/app.js"></script>
    
        </body>
    
        </html>
    

    The VIP Card template looks like this:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.VIpcard>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "Master.cshtml";
    }
    
    @Model.Content.dailyIndividual
    
  • Tarik | WPPlumber 179 posts 801 karma points c-trib
    Feb 17, 2019 @ 22:26
    Tarik | WPPlumber
    1

    Gibran, try to use @Model.Content.DailyIndividual more info here. Also in the code you posted there is the following:

    public decimal DailyIndividual
            {
                get { return this.GetPropertyValue<decimal>("dailyIndividual"); }
            }
    
  • Gibran Shah 69 posts 240 karma points
    Feb 20, 2019 @ 03:20
    Gibran Shah
    0

    Thanks both for your suggestion.

    I changed dailyIndividual to DailyIndividual and it worked.

    I assumed the attribute...

    [ImplementPropertyType("dailyIndividual")]

    ...would take car of the lower case d, but I guess not. But if not, what does this attribute do?

    Also, why does umbraco generate the property with an upper case D when the property alias in the document type has a lower case d?

  • Chris Evans 137 posts 353 karma points c-trib
    Feb 20, 2019 @ 07:33
    Chris Evans
    0

    The attribute denotes the property represents that alias on the doctype. It’s there because you can extend these classes with your own properties and override the generated ones.

    You can see more info about the attributes here:

    https://github.com/zpqrtbnk/Zbu.ModelsBuilder/wiki/ModelsGenerationConfiguration

    The reason the property starts with an uppercase D is down to naming conventions. All the API properties start with capitals like .Name or .Url — so the generated ones do too.

    Hope that helps :)

Please Sign in or register to post replies

Write your reply to:

Draft