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. Advertising

  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. 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. karim
    Replies:
    0
    Views:
    457
    karim
    Jul 13, 2003
  2. Josh Harris
    Replies:
    4
    Views:
    3,706
    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:
    505
    Joerg Jooss
    Jul 1, 2005
  4. John Dalberg
    Replies:
    3
    Views:
    569
    samuelhon
    Nov 16, 2006
  5. Chicken McNuggets

    Best book on C gotchas and best practices?

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

Share This Page