I have an 100 aspx files with one module file for code. All these aspx files have the same backend function, so i created on public module for all these files to access. These files are in the same folder. But for some reason the aspx files cannot access the function from that module.
mod1.vb Code (.vb file)
Public Module Allinone
Sub Allinone_Load(ByRef Page As Web.UI.Page)
End Sub
End Module
code in aspx file - (a1.aspx - one of 100 aspx files, they all shall have same starting script)
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Allinone_Load(Page)
开发者_开发技巧 End Sub
</script>
I am at a roadblock of why the aspx files wont read this module? Also all these files are in the same directory
The most likely cause for this not working is that the Module
and ASPX page are in different namespaces. If the module is in a namespace make sure it's imported in the ASPX page or just fully qualify the name of the module.
For Example: Instead of just calling Allinone_Load
use the fully qualified name
$YourProjectNamespace$.Allineone.Allinone_Load(Page)
You'll need to replace $YourProjectNamespace$ with the actual namespace of your project (if it has one).
精彩评论