テキストを指定して、LiteralControl クラスの新しいインスタンスを初期化します。
名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Public Sub New ( _
text As String _
)
'使用
Dim text As String
Dim instance As New LiteralControl(text)
public LiteralControl (
string text
)
public:
LiteralControl (
String^ text
)
public LiteralControl (
String text
)
public function LiteralControl (
text : String
)
適用できません。
パラメータ
- text
要求された Web ページに表示されるテキスト。
使用例
LiteralControl コンストラクタを使用して、LiteralControl クラスの 2 つのインスタンスを作成するコード例を次に示します。2 つのインスタンスは、H3 HTML 要素の開始タグと終了タグをレンダリングし、H3 タグ内に表示されるテキストを挿入します。
' Add two LiteralControls that render HTML H3 elements and text.
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub CreateChildControls()
Me.Controls.Add(New LiteralControl("<h3>Value: "))
Dim Box As New TextBox
Box.Text = "0"
Me.Controls.Add(box)
Me.Controls.Add(New LiteralControl("</h3>"))
End Sub
// Add two LiteralControls that render HTML H3 elements and text.
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
protected override void CreateChildControls() {
this.Controls.Add(new LiteralControl("<h3>Value: "));
TextBox box = new TextBox();
box.Text = "0";
this.Controls.Add(box);
this.Controls.Add(new LiteralControl("</h3>"));
}
// Add two LiteralControls that render HTML H3 elements and text.
protected void CreateChildControls()
{
this.get_Controls().Add(new LiteralControl("<h3>Value: "));
TextBox box = new TextBox();
box.set_Text("0");
this.get_Controls().Add(box);
this.get_Controls().Add(new LiteralControl("</h3>"));
} //CreateChildControls
// Add two LiteralControls that render HTML H3 elements and text.
protected override function CreateChildControls()
{
this.Controls.Add(new LiteralControl("<h3>Value: "));
var box : TextBox = new TextBox();
box.Text = "0";
this.Controls.Add(box);
this.Controls.Add(new LiteralControl("</h3>"));
}
プラットフォーム
Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
LiteralControl クラス
LiteralControl メンバ
System.Web.UI 名前空間
LiteralControl.Text