the LiteralControl is part of the base web.ui class. it allows simple output
of text
the Literal control is part of the WebControls namespace which is MS
abstracted web controls. these controls all support binding and viewstate.
this control if viewstate is turned on, will remember its properties across
a post back, unlike the above control. neither of these controls outputs
anything but the text (no tags)
the Label control is a design error by MS. its a Literal with a span so you
can apply a style to it. they meant to be used as a caption for controls
(because you can set a style). but you should not do this.
there is a real html <label> control, and section 508 compliance
(disabilities act requires this for any gov html site) requires every form
input control have a label with it "for" attribute identifying the matching
input control. this requirement is to support text readers. a simple form
should be coded as
<form id=runat=server>
<label for=textbox1>input name:</label>
<asp:textbox id=textbox1 runat=server />
<asp:button runat=server id=button1 text=submit>
</form>
the "for" attribute on the label should be the id of the input control for
which its the label. this becomes important if the table is used to align
the content as they are no longer adjacent.
while its easy to type in the id this case, if you use a template, or the
input control in in user control, the actual id render is not the one you
typed but rathe the UniqueId. this now means you have to set the "for"
attibute in the codebehind, a real pain. i wrote my own caption class to get
around this.
-- bruce (sqlwork.com)
"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:C9**********************************@microsof t.com...
I know that the Literal control will not render a <span> tag so I can not
format its text. Other than this, what is the difference betwen the
Literal
control and the LiteralControl Control? How about a LiteralControl and a
Label?
Other than the lack of being able to format the Literal control's text, I
don't see much of a difference in the documentation.
TIA,
--
Joe
VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation