UserControls

Discussion in 'ASP .Net' started by Ash, Nov 19, 2003.

  1. Ash

    Ash Guest

    What is the advantage of using a user control over a .aspx
    page..
    Ash, Nov 19, 2003
    #1
    1. Advertising

  2. Ash,

    In a word, reusability. In legacy ASP, developers would often use include
    pages for shared content. User Controls are the ASP.NET equivalent when
    robust functionality is required in shared content.

    Jim Cheshire, MCSE, MCSD [MSFT]
    Developer Support
    ASP.NET


    This post is provided as-is with no warranties and confers no rights.

    --------------------
    >Content-Class: urn:content-classes:message
    >From: "Ash" <>
    >Sender: "Ash" <>
    >Subject: UserControls
    >Date: Wed, 19 Nov 2003 07:49:09 -0800
    >Lines: 2
    >Message-ID: <0ec801c3aeb4$abec6b10$>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="iso-8859-1"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    >Thread-Index: AcOutKvs9mrAnxS3SkqILgq9KPhTLA==
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >Path: cpmsftngxa07.phx.gbl
    >Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191250
    >NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >What is the advantage of using a user control over a .aspx
    >page..
    >
    Jim Cheshire [MSFT], Nov 19, 2003
    #2
    1. Advertising

  3. Another important reason is that you can cache the output of a user control.

    For example, by putting

    <%@ OutputCache Duration=60 VaryByParam="none" %>

    at the top of your user control, you will cache the user control's rendered
    output for 60 seconds.

    --
    ----------------------------------------------------------------
    Peter Provost
    Weblog: http://www.peterprovost.org/
    ----------------------------------------------------------------



    "Jim Cheshire [MSFT]" <> wrote in message
    news:...
    > Ash,
    >
    > In a word, reusability. In legacy ASP, developers would often use include
    > pages for shared content. User Controls are the ASP.NET equivalent when
    > robust functionality is required in shared content.
    >
    > Jim Cheshire, MCSE, MCSD [MSFT]
    > Developer Support
    > ASP.NET
    >
    >
    > This post is provided as-is with no warranties and confers no rights.
    >
    > --------------------
    > >Content-Class: urn:content-classes:message
    > >From: "Ash" <>
    > >Sender: "Ash" <>
    > >Subject: UserControls
    > >Date: Wed, 19 Nov 2003 07:49:09 -0800
    > >Lines: 2
    > >Message-ID: <0ec801c3aeb4$abec6b10$>
    > >MIME-Version: 1.0
    > >Content-Type: text/plain;
    > > charset="iso-8859-1"
    > >Content-Transfer-Encoding: 7bit
    > >X-Newsreader: Microsoft CDO for Windows 2000
    > >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    > >Thread-Index: AcOutKvs9mrAnxS3SkqILgq9KPhTLA==
    > >Newsgroups: microsoft.public.dotnet.framework.aspnet
    > >Path: cpmsftngxa07.phx.gbl
    > >Xref: cpmsftngxa07.phx.gbl

    microsoft.public.dotnet.framework.aspnet:191250
    > >NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
    > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    > >
    > >What is the advantage of using a user control over a .aspx
    > >page..
    > >

    >
    Peter Provost, Nov 19, 2003
    #3
  4. Good point, Peter. It's important to note, however, that output caching is
    not limited to just User Controls, so it's not really a specific benefit
    just to User Controls.

    Jim Cheshire, MCSE, MCSD [MSFT]
    Developer Support
    ASP.NET


    This post is provided as-is with no warranties and confers no rights.

    --------------------
    >From: "Peter Provost" <>
    >References: <0ec801c3aeb4$abec6b10$>

    <>
    >Subject: Re: UserControls
    >Date: Wed, 19 Nov 2003 11:32:59 -0700
    >Lines: 60
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    >Message-ID: <>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >NNTP-Posting-Host: ilg195.ilg.com 63.117.253.195
    >Path:

    cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
    .phx.gbl!TK2MSFTNGP09.phx.gbl
    >Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191328
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >Another important reason is that you can cache the output of a user

    control.
    >
    >For example, by putting
    >
    ><%@ OutputCache Duration=60 VaryByParam="none" %>
    >
    >at the top of your user control, you will cache the user control's rendered
    >output for 60 seconds.
    >
    >--
    >----------------------------------------------------------------
    > Peter Provost
    > Weblog: http://www.peterprovost.org/
    >----------------------------------------------------------------
    >
    >
    >
    >"Jim Cheshire [MSFT]" <> wrote in message
    >news:...
    >> Ash,
    >>
    >> In a word, reusability. In legacy ASP, developers would often use

    include
    >> pages for shared content. User Controls are the ASP.NET equivalent when
    >> robust functionality is required in shared content.
    >>
    >> Jim Cheshire, MCSE, MCSD [MSFT]
    >> Developer Support
    >> ASP.NET
    >>
    >>
    >> This post is provided as-is with no warranties and confers no rights.
    >>
    >> --------------------
    >> >Content-Class: urn:content-classes:message
    >> >From: "Ash" <>
    >> >Sender: "Ash" <>
    >> >Subject: UserControls
    >> >Date: Wed, 19 Nov 2003 07:49:09 -0800
    >> >Lines: 2
    >> >Message-ID: <0ec801c3aeb4$abec6b10$>
    >> >MIME-Version: 1.0
    >> >Content-Type: text/plain;
    >> > charset="iso-8859-1"
    >> >Content-Transfer-Encoding: 7bit
    >> >X-Newsreader: Microsoft CDO for Windows 2000
    >> >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    >> >Thread-Index: AcOutKvs9mrAnxS3SkqILgq9KPhTLA==
    >> >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >> >Path: cpmsftngxa07.phx.gbl
    >> >Xref: cpmsftngxa07.phx.gbl

    >microsoft.public.dotnet.framework.aspnet:191250
    >> >NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
    >> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >> >
    >> >What is the advantage of using a user control over a .aspx
    >> >page..
    >> >

    >>

    >
    >
    >
    Jim Cheshire [MSFT], Nov 19, 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. Andreas Klemt
    Replies:
    0
    Views:
    384
    Andreas Klemt
    Jul 8, 2003
  2. Charles A. Lackman

    className Attribute (UserControls)

    Charles A. Lackman, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    403
    Charles A. Lackman
    Jul 8, 2003
  3. Antonio Maciel

    Validator controls and usercontrols

    Antonio Maciel, Jul 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    363
    Antonio Maciel
    Jul 9, 2003
  4. Jody Fisher

    Re: Using UserControls in a DLL

    Jody Fisher, Jul 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    430
    Sam Vanderstraeten
    Jul 29, 2003
  5. SamIAm
    Replies:
    2
    Views:
    398
    SamIAm
    Aug 21, 2003
Loading...

Share This Page