When I call static method from asp page I got this Compilation Error:
CS0103: The name 'Tudo' does not exist in the current context
Line 10: <script src="<%= Tudo.getFromDefinicao("winJS") %>" type="text/javascript"></script>
Tudo is a static class which is in App_Code paste, and the namespace is the same of my asp pages.
namespace MySite
{
public static class Tudo
{
public static string getFromDefinicao(string key)
{
//do some stuff
return myString;
}
}
}
I want call getFromDefinicao(...) method from my asp, but asp don't find the class (in this case i'm calling in my MasterPage). If I call the methods inside Tudo.cs from MasterPage.cs I have no problem, and I don't need to declare "using 'namespace';" because they are in the same namespace...
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="MySite.MasterPage" %>
<html>
<head>
<script src="<%= Tudo.getFromDefinicao("winJS") %>" type="text/javascript"></script>
</head>
.......
What I have to do to solve this?