views:

25

answers:

1

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

A: 

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).

JaredPar
could you elaborate more on that. like give me an example.
lkeisj
the project doesnt have a namespace. It 100 aspx files (basically just text in them) and one .vb file for all of them to use. No project.
lkeisj