Copied to clipboard

Flag this post as spam?

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


  • Edgar Arroyo 19 posts 161 karma points
    Jun 05, 2019 @ 21:31
    Edgar Arroyo
    0

    Added a property to Sample Website Home page but can't access it.

    Not sure why, but I added a property named "Test Property" which created testProperty of type Umbraco.TextBox to Home but I can't access it's values or even the property at all. Using the same example in Master...

    var home = (Home)Model.Root();
    var font = home.Font;
    // mine
    var test = home.testProperty;
    

    I get the error

    Compiler Error Message: CS1061: 'Home' does not contain a definition for 'testProperty' and no accessible extension method 'testProperty' accepting a first argument of type 'Home' could be found (are you missing a using directive or an assembly reference?)
    

    What am I missing here?

  • Arnim Anhut 137 posts 148 karma points
    Jun 06, 2019 @ 07:38
    Arnim Anhut
    1

    Hello Edgar,

    the DocumentType you changed and try to access is "Home"? Then your cast seems right.

    But properties always start with captial letters. So it should be "TestProperty".

    Hope this helps, Arnim.

  • Edgar Arroyo 19 posts 161 karma points
    Jun 07, 2019 @ 16:56
    Edgar Arroyo
    0

    This is not working.... Maybe I am doing this wrong??? Something this simple shouldn't give me any issues....

    Here is a picture of what I did...

    enter image description here

  • Edgar Arroyo 19 posts 161 karma points
    Jun 07, 2019 @ 18:48
    Edgar Arroyo
    100

    Huh.... I can get the value using home.Value("testProperty")

    How is "Font" setup where it is accessible via home.Font?

Please Sign in or register to post replies

Write your reply to:

Draft