Reusable functions

Discussion in 'ASP .Net' started by Danny, Jan 15, 2004.

  1. Danny

    Danny Guest

    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
     
    Danny, Jan 15, 2004
    #1
    1. Advertising

  2. Danny

    gabriel Guest

    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
     
    gabriel, Jan 15, 2004
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Kevin Spencer, Jan 15, 2004
    #3
  4. Danny

    Danny Guest

    Thanks Kevin & Gabriel for guiding me to the right path.

    - Danny

    "Kevin Spencer" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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
    > >
    > >
     
    Danny, Jan 15, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nikki
    Replies:
    3
    Views:
    508
    Nikki
    Jul 2, 2003
  2. Richard K Bethell

    datagrid as reusable datasource?

    Richard K Bethell, Nov 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    363
    Jacob Yang [MSFT]
    Dec 1, 2003
  3. Bijoy Naick

    Reusable Components

    Bijoy Naick, Nov 9, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    378
    Steve C. Orr [MVP, MCSD]
    Nov 11, 2004
  4. Toby Inkster

    Reusable form functions

    Toby Inkster, Nov 12, 2005, in forum: HTML
    Replies:
    0
    Views:
    465
    Toby Inkster
    Nov 12, 2005
  5. Josaz

    scripting lib (reusable functions)

    Josaz, Mar 4, 2004, in forum: ASP General
    Replies:
    8
    Views:
    139
    josaz
    Mar 5, 2004
Loading...

Share This Page