Copied to clipboard

Flag this post as spam?

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


  • Charles Roper 48 posts 200 karma points
    Mar 24, 2016 @ 09:41
    Charles Roper
    0

    Passing Examine search results to a @helper

    I've made a Razor @helper that takes some Examine search results:

    @helper EventDates(SearchResult evnt)
        ... do stuff ...
    {
    

    This works fine in the view file, but when I move it out to app_code into a file called EventHelpers.cshtml (because I want to use it in several templates) and invoke it using @EventHelpers.EventDates(evnt) I get a compilation error:

    Compiler Error Message: CS0122: 'System.IO.SearchResult' is inaccessible due to its protection level

    Is there a way around this?

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Mar 24, 2016 @ 11:59
    Sebastiaan Janssen
    100

    I think you want Examine.SearchResult instead of System.IO.SearchResult?

  • Charles Roper 48 posts 200 karma points
    Mar 24, 2016 @ 12:16
    Charles Roper
    0

    Interesting, yes that did it. VS says the Examine. reference is redundant, but putting it in there solved the problem. I got another error at first, but managed to clear is using the mysterious force of the refresh.

    Thanks Sebastiaan.

Please Sign in or register to post replies

Write your reply to:

Draft