Copied to clipboard

Flag this post as spam?

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


  • Bob 38 posts 160 karma points
    Jun 29, 2016 @ 12:36
    Bob
    0

    Help with partialview code

    I am writing a partial view as below

    @helper test {

    hello

    }

    @test test

    When I add this partialView to a page the word hello never shows? What am I doing wrong?

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Jun 29, 2016 @ 13:05
    Michaël Vanbrabandt
    1

    Hi Bob,

    Take a look at this blog from ScottGu that explains the helper method syntax:

    http://weblogs.asp.net/scottgu/asp-net-mvc-3-and-the-helper-syntax-within-razor

    In your example if you want to display the hello text you could something like:

    @helper SayHello() {
        <p>Hello!</p>
    }
    
    @SayHello()
    

    /Michaël

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies