473,396 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Where do I put a generic function used in all pages??

Hi all,

I'm still learning asp.net so this may seem a simple question, but
here goes anyway. I have a generic function that I wish to access
from all pages in my web application. Intead of putting this
function into the code-behind of every page, is there somewhere I can
put it so that it can access it from all pages? I tried doing it the
same way that I create a class with a namespace etc.. but that didin't
work. I tried placing it in the global.asax but that didn't work
either.

Any help would be appreciated

Thanks

Rene
Nov 18 '05 #1
2 1033
create a generic page with this function, then inherit from it for all your
other pages, that's what we do with great sucess.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"wrecker" <wr*****@wrecked.com> wrote in message
news:2s********************************@4ax.com...
Hi all,

I'm still learning asp.net so this may seem a simple question, but
here goes anyway. I have a generic function that I wish to access
from all pages in my web application. Intead of putting this
function into the code-behind of every page, is there somewhere I can
put it so that it can access it from all pages? I tried doing it the
same way that I create a class with a namespace etc.. but that didin't
work. I tried placing it in the global.asax but that didn't work
either.

Any help would be appreciated

Thanks

Rene

Nov 18 '05 #2
Well, you could always give your global.asax a classname. The you can add
methods etc to it as you would any other class and they would be available
to the code base.

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"wrecker" <wr*****@wrecked.com> wrote in message
news:2s********************************@4ax.com...
Hi all,

I'm still learning asp.net so this may seem a simple question, but
here goes anyway. I have a generic function that I wish to access
from all pages in my web application. Intead of putting this
function into the code-behind of every page, is there somewhere I can
put it so that it can access it from all pages? I tried doing it the
same way that I create a class with a namespace etc.. but that didin't
work. I tried placing it in the global.asax but that didn't work
either.

Any help would be appreciated

Thanks

Rene

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Roman Suzi | last post by:
Hi, I wonder, does Python support generic programming paradigm, and to what extent (I guess, it doesn't do it in full)? And (or) does it move in that direction? Will we ever see concept...
5
by: Richard Brown | last post by:
Ok, I've been looking through the .NET SDK docs and stuff. I'm wondering if you can provide a control extender that does generic validation or functionality just by dropping it on the form. For...
4
by: hazz | last post by:
public abstract class FormShellApplication<TWorkItem, TShell> : WindowsFormsApplication<TWorkItem, TShell> where TWorkItem : WorkItem, new() where TShell : Form thank you, -hazz
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
13
by: michel | last post by:
Hi, i created a class 'test' with a method 'descrlimit()' (no matter). That method is used in a lot of pages in the application, so i need to put this code a lot of time: "Dim odescr As New...
4
by: mojeza | last post by:
I would like to create generic object which will be used for store of single row of DataTable. Lets say I create class as follow: Public Class Participant Public ParticipantID As Int64 Public...
32
by: copx | last post by:
Why doesn't the C standard include generic function pointers? I use function pointers a lot and the lack of generic ones is not so cool. There is a common compiler extension (supported by GCC...
5
by: Bill McCormick | last post by:
Hi C# programmers, I'd like to be able to call a static function or property and have it return a generic list. The compiler indicates that "static types cannot be used as generic arguments", so...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.