whats the best way to?

Discussion in 'ASP .Net' started by Guy Bradley, Aug 5, 2003.

  1. Guy Bradley

    Guy Bradley Guest

    write one function (for navigation) and call it in multiple asp.net pages? -
    i would use an include file as i do in asp but i gather this isnt the best
    way of doing it...

    suggestion? - thx in advance
     
    Guy Bradley, Aug 5, 2003
    #1
    1. Advertising

  2. Create a class. Instantiate it where you need it.
    Another approach would be to create a user control or custom control. This
    would likely be a better approach if common UI is involved.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net



    "Guy Bradley" <> wrote in message
    news:...
    > write one function (for navigation) and call it in multiple asp.net

    pages? -
    > i would use an include file as i do in asp but i gather this isnt the best
    > way of doing it...
    >
    > suggestion? - thx in advance
    >
    >
     
    Steve C. Orr, MCSD, Aug 5, 2003
    #2
    1. Advertising

  3. Yes, in fact, you can often create a static method of a class, so that it
    isn't even necessary to instantiate the class to use the method.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Complex things are made up of
    lots of simple things.

    "Steve C. Orr, MCSD" <> wrote in message
    news:...
    > Create a class. Instantiate it where you need it.
    > Another approach would be to create a user control or custom control.

    This
    > would likely be a better approach if common UI is involved.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > http://Steve.Orr.net
    >
    >
    >
    > "Guy Bradley" <> wrote in message
    > news:...
    > > write one function (for navigation) and call it in multiple asp.net

    > pages? -
    > > i would use an include file as i do in asp but i gather this isnt the

    best
    > > way of doing it...
    > >
    > > suggestion? - thx in advance
    > >
    > >

    >
    >
     
    Kevin Spencer, Aug 5, 2003
    #3
  4. Guy,

    Since UI is involved (rather than just business logic), I would suggest
    creating your own page object (inherit from Page) and then inherit all your
    pages from this new page object (instead of Page). Then all the protected
    and public methods and properties that you add to your page object will be
    available to all or your descendant pages. This method even allows you to
    add code to the page object's Page_Load event to 'hardwire' the execution of
    your navigation methods so that you don't even write any navigation code at
    all in the descendant pages. Starting to solve things this way is the
    first step to thinking OO instead of Cut-and-Paste (or Include in this
    case).

    Jay Warmack, MCAD
    ..Net Consultant



    "Guy Bradley" <> wrote in message
    news:...
    > write one function (for navigation) and call it in multiple asp.net

    pages? -
    > i would use an include file as i do in asp but i gather this isnt the best
    > way of doing it...
    >
    > suggestion? - thx in advance
    >
    >
     
    Jay Warmack, MCAD, Aug 5, 2003
    #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. suzy

    whats the best way to do this?

    suzy, Apr 14, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    307
  2. Replies:
    1
    Views:
    418
    Peter Flynn
    Mar 22, 2005
  3. Towner
    Replies:
    18
    Views:
    1,000
    Vince Morgan
    Nov 8, 2006
  4. Steve

    whats the best way to do this?

    Steve, Jul 12, 2007, in forum: ASP .Net
    Replies:
    19
    Views:
    514
    Juan T. Llibre
    Jul 12, 2007
  5. Greg
    Replies:
    5
    Views:
    374
Loading...

Share This Page