469,923 Members | 1,543 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

Reusable functions

In classic ASP, if I have a function that will be used many times, I just
put it in include file, and add, for example <!-- #include
file='myfunction.inc' --> in the file where I want to use that function.

How do I do this in ASP.Net? Got bit confused, especially because HTML and
the VB.Net code is located in separate files.

Thanks in advance,

- Danny
Nov 18 '05 #1
3 1482
Danny wrote:
In classic ASP, if I have a function that will be used many times, I
just put it in include file, and add, for example <!-- #include
file='myfunction.inc' --> in the file where I want to use that
function.


You gotta change your mindset. Look into "class libraries." They work
different, but are infinitely better than #included files.

--
gabriel
Nov 18 '05 #2
ASP is procedural, whereas ASP.Net is object-oriented. In ASP, you could
create re-usable functions. In ASP.Net, you create re-usable classes, which
are much better, because they can contain functions (Methods) as well as
data (Properties and Fields). Instead of including them with server-side
includes, you reference them (the assemblies/DLLs containing them) from your
other classes.

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

"Danny" <da******@NoSPAMmyrealbox.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
In classic ASP, if I have a function that will be used many times, I just
put it in include file, and add, for example <!-- #include
file='myfunction.inc' --> in the file where I want to use that function.

How do I do this in ASP.Net? Got bit confused, especially because HTML and
the VB.Net code is located in separate files.

Thanks in advance,

- Danny

Nov 18 '05 #3
Thanks Kevin & Gabriel for guiding me to the right path.

- Danny

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:O2**************@TK2MSFTNGP10.phx.gbl...
ASP is procedural, whereas ASP.Net is object-oriented. In ASP, you could
create re-usable functions. In ASP.Net, you create re-usable classes, which are much better, because they can contain functions (Methods) as well as
data (Properties and Fields). Instead of including them with server-side
includes, you reference them (the assemblies/DLLs containing them) from your other classes.

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

"Danny" <da******@NoSPAMmyrealbox.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
In classic ASP, if I have a function that will be used many times, I just put it in include file, and add, for example <!-- #include
file='myfunction.inc' --> in the file where I want to use that function.

How do I do this in ASP.Net? Got bit confused, especially because HTML and the VB.Net code is located in separate files.

Thanks in advance,

- Danny

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tony Marston | last post: by
27 posts views Thread by Matt Kruse | last post: by
2 posts views Thread by DaleMan | last post: by
reply views Thread by Toby Inkster | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.