I have an extension method which I can use from the .cs codebehind of an aspx page, but if I try to do it in a code block in the aspx, it can't find the extension method. Is th开发者_JAVA百科ere something I need to add to the page?
You need to include the namespace containing the extension method at the top of the page, like this:
<%@ Import Namespace="Your.Namespace" %>
You can also include it globally in Web.config:
<pages>
    <namespaces>
        <add namespace="Your.Namespace" />
    </namespaces>
</pages>
The appropriate using directive:
<%@ Import Namespace="NamespaceContainingTheStaticClass" %>
Or even better do it globally in web.config
<pages>
   <namespaces>
      <add namespace="NamespaceContainingTheStaticClass" />
   </namespaces>
</pages>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论