Using global function for all web forms

  • Thread starter Thread starter RA
  • Start date Start date
R

RA

Hi

Is it possible to have a global function that I can access from all the aspx
web forms? This function basically will reset the Cache object to delete all
the stored fields within it.


Thanks,
Ronen
 
You could create your own class that inherits from the Page class and set
all of your aspx pages to Inherit from your custom Page class instead of
Page directly. From there you could create functions that any of your pages
can access. Another option is to create a Static/Shared method in a class
somewhere and just call that. Keep in mind if you do that you'll have to
pass the context of whatever you're working with.
 
Create a class. Instantiate it where you need it. It's as simple as that.
If you create the methods as Shared (in VB.NET) or Static (in C#) then you
don't even have to instantiate the
class.

If you're using VB.NET you have another option: Create a code module.
 
Steve:

In the designer do I just right click the solution explorer and add a class?
Will this become a class that I can access from all the code behind vb.net
code for all the forms and the global.asax.vb?

Dab
 
Back
Top