Ask a Question related to ASP.NET General, Design and Development.
-
Matthew Hood #1
How to create global Funtions & Routines
I'm at a loss on how to create global functions for my website.
Essentially, I have several different functions I use throughout my site and
I want to be able to put these in 1 file and call them from anywhere.
Currently, I just copy them into each aspx file... Not what I want to do.
Any help? BTW, I am using WebMatrix to develope the aspx forms.
TIA
-Matt
Matthew Hood Guest
-
Want to create a stand-alone CD of Flash that does not require users to adjust global security settings panel (always allow)
I am trying to put a swf file on to a CD to standalone offline. The swf file points to html files that are included on the CD. When I click on... -
Calling on Visual Basic funtions
How can I call a funtion on Visual Basic from the event "Onblur" of a Textbox,,, in a webpage? -
OCR funtions in Acrobat 7 SDK
Hi I have a rather simple question - can I programmatically (from VB for example) use the Acrobat 7 SDK API functions to control/operate the OCR... -
Wizards to create table maintainance routines?
I've been using CF for many years and have created numerous applications to allow users to add, update and delete records from SQL tables. However,... -
IBM AIX 5.1 routines
i need help finding out what these two aix routines are/do: local_lock_ppc_mp local_unlock_ppc_mp Does anyone have any info on where I can found... -
MC D #2
Re: How to create global Funtions & Routines
Welcome to object oriented programming. ;o)
Each page in your site is a class. You'll note at the top of your
codebehind file (I'm assuming you have this in webmatrix?) that you specifiy
a class name for your page... e.g. "Public Class myPage"... this "page" is a
public class, so it is available to any part of your application. (Assuming
it exposes the methods you need).
Lets assume you have a function in your codebehind file that you want to
access elsewhere in your web application. You can just create an instance
of the other "page" (class) from within your current codebehind file by
just stating:
dim myTool as new myPage()
where myPage is the class that contains the method you wish to use. For
example if you had a function that added two numbers in your myPage class
called "addIt" you could say:
dim myTool as new myPage()
dim myresult as Integer = myTool.addIt(number1, number2)
What you really need to do is have a class library. (just a file with a .vb
extension) in you application with the classes you wish to implement
globally, that way when you create an instance of the "tool" you need you
aren't using all the extra memory neccessary to create an instance of the
myPage class. (because it inherits from the Page class which has a ton of
methods, etc..)
Hope that helps.
-MC D
"Matthew Hood" <mshood@qwest.net> wrote in message
news:uoU6kcpODHA.3020@TK2MSFTNGP10.phx.gbl...and> I'm at a loss on how to create global functions for my website.
> Essentially, I have several different functions I use throughout my site> I want to be able to put these in 1 file and call them from anywhere.
> Currently, I just copy them into each aspx file... Not what I want to do.
>
> Any help? BTW, I am using WebMatrix to develope the aspx forms.
> TIA
> -Matt
>
>
MC D Guest
-
Matthew Hood #3
Re: How to create global Funtions & Routines
Webmatrix does not use the Codebehind method.
Initially I created the functions in a .vb file, but when I tried to access
them from a page, I get an error stating that the routines were not defined.
Do the vb files have to be compiled?
TIA-
Matt
"MC D" <nospam@earthtalk.com> wrote in message
news:vfi9po4kc9np5c@corp.supernews.com...specifiy> Welcome to object oriented programming. ;o)
>
> Each page in your site is a class. You'll note at the top of your
> codebehind file (I'm assuming you have this in webmatrix?) that youa> a class name for your page... e.g. "Public Class myPage"... this "page" is(Assuming> public class, so it is available to any part of your application...vb> it exposes the methods you need).
>
> Lets assume you have a function in your codebehind file that you want to
> access elsewhere in your web application. You can just create an instance
> of the other "page" (class) from within your current codebehind file by
> just stating:
>
> dim myTool as new myPage()
>
> where myPage is the class that contains the method you wish to use. For
> example if you had a function that added two numbers in your myPage class
> called "addIt" you could say:
>
> dim myTool as new myPage()
> dim myresult as Integer = myTool.addIt(number1, number2)
>
> What you really need to do is have a class library. (just a file with ado.> extension) in you application with the classes you wish to implement
> globally, that way when you create an instance of the "tool" you need you
> aren't using all the extra memory neccessary to create an instance of the
> myPage class. (because it inherits from the Page class which has a ton of
> methods, etc..)
>
> Hope that helps.
>
> -MC D
>
>
> "Matthew Hood" <mshood@qwest.net> wrote in message
> news:uoU6kcpODHA.3020@TK2MSFTNGP10.phx.gbl...> and> > I'm at a loss on how to create global functions for my website.
> > Essentially, I have several different functions I use throughout my site> > I want to be able to put these in 1 file and call them from anywhere.
> > Currently, I just copy them into each aspx file... Not what I want to>> >
> > Any help? BTW, I am using WebMatrix to develope the aspx forms.
> > TIA
> > -Matt
> >
> >
>
Matthew Hood Guest



Reply With Quote

