tags:

views:

11

answers:

2

Hi. I am using visual studio 2008, asp.net.vb

I have various functions; 1 that calculates totals, 1 that calculates averages, 1 that calculates percentages etc. The data they act upon is different depending on the particular web page, but all my pages use these functions. So I want to know how I can store these functions in a single place so that all of my web pages can access the routines. At the moment all I know how to do is to write seperate functions in the code-behind for each individual web page. Obviously that is just so long winded and inefficient, but try as I might I can't figure out how to do it better. Please can anyone help. Many thanks.

A: 

You can add a class to the App_Code folder (it is special ASP.NET folder that you can add from the context menu in the VS) and place your routines there. All classes from that folder are visible to the pages.

Andrew Bezzub
Thank you thank you! I can't describe the frustration that simple little problem has caused me. Your response was triffik!! Thank you.
si
A: 

Create a class and make it Static (c#)/Share (VB)...as well as your Functions

hallie