web form user control best practices?

Discussion in 'ASP .Net' started by noname, Jun 26, 2003.

  1. noname

    noname Guest

    i have a few user controls that need a "visible" property. one example is
    an error box. the error box's visible property would only be set in the
    event of an error, of course. i've come up with two methods to do this,
    neither of which seem optimal.

    1. user control consists of simply a single <asp:label>. all output - be
    it table tags, row tags, etc. - is set to the label's text property when the
    user control's visible property is true.

    2. user control consists of a few <asp> control - labels, text boxes,
    etc. - and when the user control's visible property is set or reset i do the
    same for each <asp> control.

    (1) has the funny feeling of how one programs in regular old ASP. (2)
    doesn't allow other non ASP.NET content because normal <html> tags can't be
    turned on and off like <asp> controls.

    i'd like to do something like the following and still have the entire
    thing's visibility togglable:

    <%@ control codebehind="foo.cs" ... %>
    <table>
    <tr>
    <td><asp:label id="lblFoo" runat="server">Foo</asp:label></td>
    <td><asp:textbox id="txtFoo" runat="server"></asp:textbox></td>
    </tr>
    </table>

    now, to be able to turn the <table> output on or off too ...

    thanks for any help!
    noname
     
    noname, Jun 26, 2003
    #1
    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:
    489
    karim
    Jul 13, 2003
  2. Josh Harris
    Replies:
    4
    Views:
    3,734
    Josh Harris
    Apr 17, 2004
  3. David Bowey
    Replies:
    1
    Views:
    460
    Steve C. Orr [MVP, MCSD]
    Mar 16, 2005
  4. David Bowey

    Best Practices: Porting ASCX control to compiled Custom Control?

    David Bowey, Mar 16, 2005, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    184
    Steve C. Orr [MVP, MCSD]
    Mar 16, 2005
  5. David Bowey
    Replies:
    1
    Views:
    154
    Steve C. Orr [MVP, MCSD]
    Mar 16, 2005
Loading...

Share This Page