User Controls/Design Best Practices

Discussion in 'ASP .Net' started by =?Utf-8?B?TmF0aGFuVg==?=, Oct 2, 2004.

  1. In traditional ASP I used to pretty much replicate what is now being done in
    ASP.NET 2.0 with the master pages. I would create a header include file that
    included everything up to the main content cell, and a footerthat included
    the rest. I've been creating header user controls in asp.net but have run
    into problems.

    1) How do I work around only being allowed 1 form for page? If my user
    control has server controls and a form in it, and so does my page, how can
    they co-exist?

    2) How can I programmatically access elements (i.e. a label or panel) in
    the UC from the page that holds the user control.

    Thanks, I appreciate the help!
     
    =?Utf-8?B?TmF0aGFuVg==?=, Oct 2, 2004
    #1
    1. Advertisements

  2. =?Utf-8?B?TmF0aGFuVg==?=

    DWinter Guest

    Ok, I assume you have your UC declared something like this?
    <uc1:myUserControl id="myUC" runat="server" />

    Well you reference the controls in the UserControl part with
    myUC.controlID.Value
    where in the page that is hosting the user control would be just
    controlID.Value.


    "NathanV" <> wrote in message
    news:...
    > In traditional ASP I used to pretty much replicate what is now being done

    in
    > ASP.NET 2.0 with the master pages. I would create a header include file

    that
    > included everything up to the main content cell, and a footerthat included
    > the rest. I've been creating header user controls in asp.net but have run
    > into problems.
    >
    > 1) How do I work around only being allowed 1 form for page? If my user
    > control has server controls and a form in it, and so does my page, how can
    > they co-exist?
    >
    > 2) How can I programmatically access elements (i.e. a label or panel) in
    > the UC from the page that holds the user control.
    >
    > Thanks, I appreciate the help!
    >
    >
    >
    >
     
    DWinter, Oct 2, 2004
    #2
    1. Advertisements

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. karim
    Replies:
    0
    Views:
    623
    karim
    Jul 13, 2003
  2. Josh Harris
    Replies:
    4
    Views:
    3,874
    Josh Harris
    Apr 17, 2004
  3. Luis Esteban Valencia

    Design Patterns Books and Best Practices Books.

    Luis Esteban Valencia, Jun 30, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    694
    Joerg Jooss
    Jul 1, 2005
  4. MassDev
    Replies:
    4
    Views:
    6,471
    Rene Moehring
    Mar 10, 2005
  5. John Dalberg
    Replies:
    3
    Views:
    738
    samuelhon
    Nov 16, 2006
  6. javerra
    Replies:
    11
    Views:
    877
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Feb 11, 2007
  7. =?Utf-8?B?SCBQb3dlbGw=?=

    ASP.NET Design and Development Best Practices?

    =?Utf-8?B?SCBQb3dlbGw=?=, Aug 9, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,906
    Kevin Spencer
    Aug 10, 2007
  8. Chicken McNuggets

    Best book on C gotchas and best practices?

    Chicken McNuggets, Jul 31, 2013, in forum: C Programming
    Replies:
    9
    Views:
    476
    Fred J. Tydeman
    Aug 5, 2013
Loading...