Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Global Function and Variables

Reply
Thread Tools

Global Function and Variables

 
 
Simon Harris
Guest
Posts: n/a
 
      05-03-2004
Hi All,

I'm new to ASP.Net, so be gentle! (Plenty of 'classic' ASP experience), just
one question...

- Am I correct in thinking that global functions are stored in ASCX files?

Thanks!

Simon.

--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!


 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      05-03-2004
No you are incorrect.
But i feel where are you coming from.

In ASP.NET if you wanted to create reusable HTML element you would create
file with a global function and include it everywhere.

And whenever you need that HTML to appear you would call that global
function.

Am i correct?

The User Control(s) - ascx file is much better choice than simple include.
I would not call it a global function though.


George.

"Simon Harris" <(E-Mail Removed)> wrote in message
news:OC%(E-Mail Removed)...
> Hi All,
>
> I'm new to ASP.Net, so be gentle! (Plenty of 'classic' ASP experience),

just
> one question...
>
> - Am I correct in thinking that global functions are stored in ASCX files?
>
> Thanks!
>
> Simon.
>
> --
> -
> * Please reply to group for the benefit of all
> * Found the answer to your own question? Post it!
> * Get a useful reply to one of your posts?...post an answer to another one
> * Search first, post later : http://www.google.co.uk/groups
> * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
>
>



 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      05-03-2004
> I'm new to ASP.Net, so be gentle! (Plenty of 'classic' ASP experience), just
> one question...
>
> - Am I correct in thinking that global functions are stored in ASCX files?


No, ASCX files, or User Controls, contain reusable user interface
pieces. Check out my article on User Controls for an in-depth
examination of User Controls:

An Extensive Examination of User Controls
http://msdn.microsoft.com/asp.net/us...ercontrols.asp

For information on global variables and functions, check out this article:

Accessing Common Code, Constants, and Functions in an ASP.NET Project
http://aspnet.4guysfromrolla.com/articles/122403-1.aspx

Happy Programming!
 
Reply With Quote
 
Simon Harris
Guest
Posts: n/a
 
      05-03-2004
George/Scott - Thanks!


 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      05-03-2004
Hi Simon,

I would recommend reading up on Object-Oriented programming. The paradigm
for OOP is entirely different from procedural programming, and unless you
understand the principles, you will continually be confounded. ASP is
procedural, meaning that the programming instructions contained in an ASP
page/script are executed in the order in which they appear in the
script/page, including the rendering of HTML in the page. ASP.Net is
Object-oriented, meaning that programming instructions are not in a script
and are not executed sequentially. Therefore, there is no such thing as a
"global function." There is Scope, but Scope is defined differently. Rather
than functions that are simply defined and called as needed, there are
classes, which are aggregates of data and functionality bundled together in
an encapsulation. The class is a container, if you will, for these various
functions and data. It doesn't execute in the procedural sense, but behaves
more like an object which can be used by another object.

The term "global," and the concept of Scope in general, are different.
Members of a class are "global" to the class; that is, they are accessible
to all class members. A class can have members that are not available
outside of the class, or to any class which doesn't inherit the class, or
are visible to any entity outside of the class. These members are scoped as
Private, Public, Protected, etc. In addition, you have the same general
types of scope that exist in an ASP application, such as the Application,
which is globally available to all classes in the application, Session,
which is global to all page instances of a single user, and so on.

Again, as ASP.Net is not procedural, it is not hepful to think of functions,
classes, and other programming objects as being "in files." ASP.Net is not
scripted, but compiled. Classes and other programming elements reside in
NameSpaces, and in assemblies. The files are simply a storage container for
the code. The file is not important; the code is. Object-oriented
programming is a good bit more abstract than procedural, but once you start
thinking object-oriented, it all snaps neatly into place.

In any case, you should be able to see now that a basic understanding of
Object-Oriented programming principles is essential to writing an ASP.Net
application.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Simon Harris" <(E-Mail Removed)> wrote in message
news:OC#(E-Mail Removed)...
> Hi All,
>
> I'm new to ASP.Net, so be gentle! (Plenty of 'classic' ASP experience),

just
> one question...
>
> - Am I correct in thinking that global functions are stored in ASCX files?
>
> Thanks!
>
> Simon.
>
> --
> -
> * Please reply to group for the benefit of all
> * Found the answer to your own question? Post it!
> * Get a useful reply to one of your posts?...post an answer to another one
> * Search first, post later : http://www.google.co.uk/groups
> * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
>
>



 
Reply With Quote
 
Simon Harris
Guest
Posts: n/a
 
      05-04-2004
"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi Simon,
>
> I would recommend reading up on Object-Oriented programming. The paradigm
> for OOP is entirely different from procedural programming, and unless you
> understand the principles, you will continually be confounded. ASP is
> procedural, meaning that the programming instructions contained in an ASP
> page/script are executed in the order in which they appear in the
> script/page, including the rendering of HTML in the page. ASP.Net is
> Object-oriented, meaning that programming instructions are not in a script
> and are not executed sequentially. Therefore, there is no such thing as a
> "global function." There is Scope, but Scope is defined differently.

Rather
> than functions that are simply defined and called as needed, there are
> classes, which are aggregates of data and functionality bundled together

in
> an encapsulation. The class is a container, if you will, for these various
> functions and data. It doesn't execute in the procedural sense, but

behaves
> more like an object which can be used by another object.
>
> The term "global," and the concept of Scope in general, are different.
> Members of a class are "global" to the class; that is, they are accessible
> to all class members. A class can have members that are not available
> outside of the class, or to any class which doesn't inherit the class, or
> are visible to any entity outside of the class. These members are scoped

as
> Private, Public, Protected, etc. In addition, you have the same general
> types of scope that exist in an ASP application, such as the Application,
> which is globally available to all classes in the application, Session,
> which is global to all page instances of a single user, and so on.
>
> Again, as ASP.Net is not procedural, it is not hepful to think of

functions,
> classes, and other programming objects as being "in files." ASP.Net is not
> scripted, but compiled. Classes and other programming elements reside in
> NameSpaces, and in assemblies. The files are simply a storage container

for
> the code. The file is not important; the code is. Object-oriented
> programming is a good bit more abstract than procedural, but once you

start
> thinking object-oriented, it all snaps neatly into place.
>
> In any case, you should be able to see now that a basic understanding of
> Object-Oriented programming principles is essential to writing an ASP.Net
> application.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "Simon Harris" <(E-Mail Removed)> wrote in message
> news:OC#(E-Mail Removed)...
> > Hi All,
> >
> > I'm new to ASP.Net, so be gentle! (Plenty of 'classic' ASP experience),

> just
> > one question...
> >
> > - Am I correct in thinking that global functions are stored in ASCX

files?
> >
> > Thanks!
> >
> > Simon.
> >
> > --
> > -
> > * Please reply to group for the benefit of all
> > * Found the answer to your own question? Post it!
> > * Get a useful reply to one of your posts?...post an answer to another

one
> > * Search first, post later : http://www.google.co.uk/groups
> > * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
> >
> >

>



Hi Kevin,

Thanks for the explanation, I will certainly have a read about OOP
concepts - It seems your right in that the basic concepts will be helpful in
making the rest 'snap into place'

Sounds to me also like ASP.Net is going to be a rather steep learning curve
for some one with no 'proper' coding knowledge - My experience is solely
self taught classic ASP and JavaScript over the past 4-5 years, building
Intranet applications.

Here goes with some hefty study sessions!

Regards,
Simon


 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      05-04-2004
Hi Simon,

A Steep learning curve, yes. Worth the effort? Most definitely! And again,
once you "get" OOP, the programming paradigm snaps into place pretty well.
In fact, I consider it easier to work with, more organized, more
encapsulated. The hard part is finding the functionality you want in the
CLR. But the .Net SDK, which is a free download, makes that job much easier
as well. If you want a free copy of the .Net SDK, see:

http://www.microsoft.com/downloads/d...displaylang=en

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Simon Harris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Kevin Spencer" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi Simon,
> >
> > I would recommend reading up on Object-Oriented programming. The

paradigm
> > for OOP is entirely different from procedural programming, and unless

you
> > understand the principles, you will continually be confounded. ASP is
> > procedural, meaning that the programming instructions contained in an

ASP
> > page/script are executed in the order in which they appear in the
> > script/page, including the rendering of HTML in the page. ASP.Net is
> > Object-oriented, meaning that programming instructions are not in a

script
> > and are not executed sequentially. Therefore, there is no such thing as

a
> > "global function." There is Scope, but Scope is defined differently.

> Rather
> > than functions that are simply defined and called as needed, there are
> > classes, which are aggregates of data and functionality bundled together

> in
> > an encapsulation. The class is a container, if you will, for these

various
> > functions and data. It doesn't execute in the procedural sense, but

> behaves
> > more like an object which can be used by another object.
> >
> > The term "global," and the concept of Scope in general, are different.
> > Members of a class are "global" to the class; that is, they are

accessible
> > to all class members. A class can have members that are not available
> > outside of the class, or to any class which doesn't inherit the class,

or
> > are visible to any entity outside of the class. These members are scoped

> as
> > Private, Public, Protected, etc. In addition, you have the same general
> > types of scope that exist in an ASP application, such as the

Application,
> > which is globally available to all classes in the application, Session,
> > which is global to all page instances of a single user, and so on.
> >
> > Again, as ASP.Net is not procedural, it is not hepful to think of

> functions,
> > classes, and other programming objects as being "in files." ASP.Net is

not
> > scripted, but compiled. Classes and other programming elements reside in
> > NameSpaces, and in assemblies. The files are simply a storage container

> for
> > the code. The file is not important; the code is. Object-oriented
> > programming is a good bit more abstract than procedural, but once you

> start
> > thinking object-oriented, it all snaps neatly into place.
> >
> > In any case, you should be able to see now that a basic understanding of
> > Object-Oriented programming principles is essential to writing an

ASP.Net
> > application.
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "Simon Harris" <(E-Mail Removed)> wrote in message
> > news:OC#(E-Mail Removed)...
> > > Hi All,
> > >
> > > I'm new to ASP.Net, so be gentle! (Plenty of 'classic' ASP

experience),
> > just
> > > one question...
> > >
> > > - Am I correct in thinking that global functions are stored in ASCX

> files?
> > >
> > > Thanks!
> > >
> > > Simon.
> > >
> > > --
> > > -
> > > * Please reply to group for the benefit of all
> > > * Found the answer to your own question? Post it!
> > > * Get a useful reply to one of your posts?...post an answer to another

> one
> > > * Search first, post later : http://www.google.co.uk/groups
> > > * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
> > >
> > >

> >

>
>
> Hi Kevin,
>
> Thanks for the explanation, I will certainly have a read about OOP
> concepts - It seems your right in that the basic concepts will be helpful

in
> making the rest 'snap into place'
>
> Sounds to me also like ASP.Net is going to be a rather steep learning

curve
> for some one with no 'proper' coding knowledge - My experience is solely
> self taught classic ASP and JavaScript over the past 4-5 years, building
> Intranet applications.
>
> Here goes with some hefty study sessions!
>
> Regards,
> Simon
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 1 10-25-2006 06:50 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 0 10-25-2006 01:04 PM
local variables and global variables king Perl Misc 2 06-27-2006 03:13 PM
Global variables on par with ASP's global.asa Wayne ASP .Net 2 11-11-2003 10:58 PM



Advertisments