Where and how to store functions in asp.net.vb
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开发者_StackOverflow中文版 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.
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.
Create a class and make it Static (c#)/Share (VB)...as well as your Functions
精彩评论