Copied to clipboard

Flag this post as spam?

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


  • Naman 20 posts 101 karma points
    Mar 29, 2016 @ 11:18
    Naman
    0

    Understanding UmbracoViewPage

    Hi All,

    I am looking for some example/link explaining how strongly typed view is being created using UmbracoViewPage.

    Can any one please help me on this?

  • Dennis Adolfi 1071 posts 6356 karma points MVP 2x c-trib
    Mar 29, 2016 @ 11:20
    Dennis Adolfi
    1

    Awsome post about this by Dave Woestenborghs:

    http://24days.in/umbraco/2015/strongly-typed-vs-dynamic-content-access/

    Hope this helpes you!!

  • Naman 20 posts 101 karma points
    Mar 29, 2016 @ 11:52
    Naman
    0

    Hi Dennis,

    Thanks for the information.

    So far i have been under impression that views in Umbraco doesn't support strongly typed views but the example give in url below shows that Model (UmbracoLogin.MemberLoginModel) is accessible through Umbraco view.

    http://24days.in/umbraco/2012/creating-a-login-form-with-umbraco-mvc-surfacecontroller/

    This is bit confusing to me.

  • Dennis Adolfi 1071 posts 6356 karma points MVP 2x c-trib
    Mar 29, 2016 @ 12:08
    Dennis Adolfi
    0

    Hi again!

    Umbraco does support strongly typed views, like in the example from the link you posted:

    @model UmbracoLogin.MemberLoginModel
    

    But you can might as well use:

    @inherits UmbracoViewPage<UmbracoLogin.MemberLoginModel>
    

    The advantage of this is that you will have access to the Umbraco Helper methods in your views. (Like CurrentPage for instance.) All this is mentioned in the articel Dave wrote in 24 days that i posted earlier.

    More about the Umbraco Helper:

    https://our.umbraco.org/documentation/Reference/Querying/UmbracoHelper/

  • Naman 20 posts 101 karma points
    Mar 29, 2016 @ 12:19
    Naman
    0

    Hi Dennis,

    Thanks for the help.

    As per my understanding we can't use strongly typed view (@model UmbracoLogin.MemberLoginModel) and @inherits UmbracoViewPage

    Please verify.

  • Dennis Adolfi 1071 posts 6356 karma points MVP 2x c-trib
    Mar 29, 2016 @ 12:21
    Dennis Adolfi
    100

    That is correct!

    The 'inherits' keyword is not allowed when a 'model' keyword is used.

    Glad i could help! Have a great day!!! :)

  • Naman 20 posts 101 karma points
    Mar 29, 2016 @ 12:34
    Naman
    1

    Hi Dennis,

    Thanks for the help.

    I am new to MVC and Umbraco that's why asking sucs questions.

  • Dennis Adolfi 1071 posts 6356 karma points MVP 2x c-trib
    Mar 29, 2016 @ 12:37
    Dennis Adolfi
    0

    Great! Thats what a forum is for, to help out when someone is new! :)

    Welcome to the great world of Umbraco!

    Good luck!

Please Sign in or register to post replies

Write your reply to:

Draft