Code library

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Code library

    Hi

    Is there a way to have code modules that all pages in a web app can access
    kinda like a code library?

    Thanks

    Regards


  • Peter Bucher [MVP]

    #2
    Re: Code library

    Hello John
    Is there a way to have code modules that all pages in a web app can access
    kinda like a code library?
    Jep

    Make a (static) Class with static Methods

    -Reference to DLL
    -Using Statement

    User your Class like:

    this.lblTest.Te xt = Tools.DoSomethi ngWith(this.lbl Test.Text);

    Surely you can also use instance Helper classes, that depents on
    what you want to reach.

    --
    Gruss, Peter Bucher
    Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
    http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
    http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET

    Comment

    • Munna

      #3
      Re: Code library

      Hi

      "Is there a way to have code modules that all pages in a web app can
      access
      kinda like a code library? "

      yes you can have...

      just add a class to your project and use in codebehind file of the
      pages...

      you can make single to tone or static class... what ever you like...

      Best of luck

      Munna




      Comment

      • Joe Fawcett

        #4
        Re: Code library



        "Munna" <munnaonc@gmail .comwrote in message
        news:0e0d0c01-dc69-4928-b306-92a5b886afc2@p3 9g2000prm.googl egroups.com...
        Hi
        >
        "Is there a way to have code modules that all pages in a web app can
        access
        kinda like a code library? "
        >
        yes you can have...
        >
        just add a class to your project and use in codebehind file of the
        pages...
        >
        you can make single to tone or static class... what ever you like...
        >
        Best of luck
        >
        Munna



        >
        What I normally do is to add a class file to the App_Code directory and
        include method sin it as I go along.
        When the site is complete I remove anything from the class file that looks
        reusable to a separate class library project for use in other apps.

        --

        Joe Fawcett (MVP - XML)


        Comment

        • Habiburahman Khalid

          #5
          Re: Code library

          Hi,
          Yea you can use the App_Code directory, just place any class you want in
          that directory it will be accessable from all pages

          Thanks



          On 5/31/08 9:36 AM, in article eSc7cwtwIHA.583 2@TK2MSFTNGP02. phx.gbl, "John"
          <info@nospam.in fovis.co.ukwrot e:
          Hi
          >
          Is there a way to have code modules that all pages in a web app can access
          kinda like a code library?
          >
          Thanks
          >
          Regards
          >
          >

          Comment

          Working...