web form user control best practices?
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" ... %>
<td><asp:label id="lblFoo" runat="server">Foo</asp:label></td>
<td><asp:textbox id="txtFoo" runat="server"></asp:textbox></td>
now, to be able to turn the <table> output on or off too ...
thanks for any help!
|All times are GMT. The time now is 09:56 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.