You will need to add a seperate code file for this code.
Example:
Add a class file "StringUtils.cs".
//sealed keeps anything from deriving from this
public sealed class StringUtils
{
public static string FormatMoney( decimal amount )
{
//return custom formatting of the amount
}
//private keeps the class from being instantiated.
private StringUtils() { }
}
Now in all your pages in the project you can access this
lblAmount.Text = StringUtils.FormatMoney( amount );
HTH,
bill
"Neil Zanella" <nz******@gmail.com> wrote in message
news:1a**************************@posting.google.c om...
Hello,
I need to access some user defined utility functions from within
my ASP.NET pages. I wonder whether there is a way to do this. I
do not want to use inheritance. I just want to be able to call
some code contained in a .cs file (C# file) from within several
.aspx and .ascx page without having to rewrite the code in each
such page. I would like to know how this can be accomplished,
including how I can ensure that ASP.NET will find the C#
source file.
Thanks,
Neil