Public functions and variables

J

John

Hi

Is there a way to declare public functions that can be accessed in any aspx
page? Can global variables be declared?

Thanks

Regards
 
T

Thomas Hansen

Hi

Is there a way to declare public functions that can be accessed in any aspx
page? Can global variables be declared?

Read up on "Singleton"...
You'd probably find a zillion implementations at google if you combine
your search with C# or something...!!

..t
 
M

Matt Vaughn

Within the code-behind of the .aspx page, you can create public methods and
properties. The page should have access to them: <#% GetCurrentTime() %>
will work if you have a public method like:

public DateTime GetCurrentTime()
{
//add code here to return DateTime value;
}
 
J

John

Thanks for that. I have created the function in Global.asax file in the
site root as follows;

script language="VB" runat="Server">
Shared Function MyFunction(ByVal d As Object, ByVal pat As Object) As Object

End Function
</script>

However when I use it in one of my pages as below;

MyVar = Global.MyFunction(Now, "dd/mm/yyyy hh:mm:ss")

I get an '"MyFunction is not a member of '<default>' error. What am I doing
wrong?

Thanks

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top