Web Server Controls->ASP.NET Literal Control
2007-03-27 09:41
549 查看
Definition and Usage
The Literal control is used to display text on a page. The text is programmable.Note:[/b] This control does not let you apply styles to its content!
Properties
Property | Description |
---|---|
id | A unique id for the control |
runat | Specifies that the control is a server control. Must be set to "server" |
Text | Specifies the text to display |
Examples
LiteralASPX Source:
<html> <body> <form runat="server"> <asp:Literal Text="I love ASP. NET!" runat="server" /> </form> </body> </html> |
I love ASP. NET! |
In this example we declare one Literal control which displays some static text in an .aspx file.
Literal 2
ASPX Source:
<script runat="server"> Sub submit(sender As Object, e As EventArgs) Literal1.Text="I love ASP.NET!" End Sub </script> <html> <body> <form runat="server"> <asp:Literal id="Literal1" Text="I love ASP!" runat="server" /> <br><br> <asp:Button Text="Change Text" OnClick="submit" runat="server" /> </form> </body> </html> |
Output Result:
I love ASP! |
I love ASP.NET! |
相关文章推荐
- Web Server Controls->ASP.NET HyperLink Control
- Web Server Controls->ASP.NET Panel Control
- Web Server Controls->ASP.NET Table Control
- Web server Controls->ASP.NET TextBox Control
- Web Server Controls->ASP.NET Button Control
- Web Server Controls->ASP.NET PlaceHolder Control
- Web Server Controls->ASP.NET Image Control
- Web Server Controls->ASP.NET ImageButton Control
- Web Server Controls->ASP.NET RadioButton Control
- Web Server Controls->ASP.NET CheckBox Control
- Web Server Controls->ASP.NET Label Control
- Web Server Controls->ASP.NET RadioButtonList Control
- Web Server Controls->ASP.NET LinkButton Control
- Web Server Controls->ASP.NET TableCell Control
- Web Server Controls->ASP.NET XML Control
- Web Server Controls->ASP.NET ListBox Control
- Web Server Controls->ASP.NET TableRow Control
- Web Server Controls->ASP.NET AdRotator Control
- Web Server Controls->ASP.NET DropDownList Control
- Janus Web/ASP.NET Server Controls v3(3.5.0.35) for VS2005