Copied to clipboard

Flag this post as spam?

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


  • Ivan 165 posts 542 karma points
    Oct 26, 2012 @ 06:17
    Ivan
    0

    How do I reference App_Code class from within a Razor script

    Hi Guys.

    I have .cs file in App_Code folder:

    namespace n1 {

    public class c1 {

    public static string m1 { }

    }

    }

     

    How do I access  "m1" method form within Razor script placed inside macroScripts folder?

  • Ivan 165 posts 542 karma points
    Oct 26, 2012 @ 06:38
    Ivan
    0

    Solution is found, thanks everybody :)

  • Evangelos Lolos 1 post 21 karma points
    Dec 12, 2012 @ 14:01
    Evangelos Lolos
    0

    Would you please post the solution for others facing the same problem?

  • Ivan 165 posts 542 karma points
    Dec 12, 2012 @ 15:24
    Ivan
    0

    Just referencing the full path to the method like:

    n1.c1.m1()

    Here's an example:

    <ul class="nav">

    @foreach (var data in someClass.getData()) {

    <li>

     <a href="#''>

    <img src="@Href(n1.c1.m1())" alt="" />

     </a>

    </li>

    }

    </ul>

  • 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