入力コントロール タイプを指定して、HtmlInputText クラスの新しいインスタンスを初期化します。
名前空間: System.Web.UI.HtmlControls
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Public Sub New ( _
type As String _
)
'使用
Dim type As String
Dim instance As New HtmlInputText(type)
public HtmlInputText (
string type
)
public:
HtmlInputText (
String^ type
)
public HtmlInputText (
String type
)
public function HtmlInputText (
type : String
)
適用できません。
パラメータ
- type
入力コントロールのタイプ。
解説
このコンストラクタを使用して、指定した入力コントロール タイプで HtmlInputText コントロールの新しいインスタンスを作成し、初期化します。このコンストラクタを使用すると、password などの特定のタイプのテキスト ボックス コントロールを作成できます。現在は password タイプまたは text タイプだけがサポートされています。このコンストラクタは、それらが利用可能になる場合に、他のタイプのテキスト ボックスを作成できるように設計されています。
HtmlInputText のインスタンスの初期プロパティ値を次の表に示します。
プロパティ |
初期値 |
---|---|
type パラメータの値。 |
![]() |
---|
このコンストラクタを使用して text タイプのテキスト ボックス コントロールを作成できますが、通常は既定のコンストラクタが使用されます。 |
使用例
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server" >
Sub Page_Load(sender As Object, e As EventArgs)
' Create an HtmlInputText control.
Dim text As HtmlInputText = New HtmlInputText("password")
text.MaxLength = 20
text.Size = 22
' Add the control to the Controls collection of the
' PlaceHolder control.
Place.Controls.Clear()
Place.Controls.Add(text)
End Sub
Sub Button_Click(sender As Object, e As EventArgs)
' Insert secure authentication here.
' Make sure to use SSL to secure the connection.
End Sub
</script>
<head runat="server">
<title> HtmlInputText Constructor Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> HtmlInputText Constructor Example </h3>
Enter your password: <br />
<asp:PlaceHolder id="Place" runat="server"/>
<br /><br />
<input type="submit"
value="Submit"
onserverclick="Button_Click"
runat="server"/>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server" >
void Page_Load(Object sender, EventArgs e)
{
// Create an HtmlInputText control.
HtmlInputText text = new HtmlInputText("password");
text.MaxLength = 20;
text.Size = 22;
// Add the control to the Controls collection of the
// PlaceHolder control.
Place.Controls.Clear();
Place.Controls.Add(text);
}
void Button_Click(Object sender, EventArgs e)
{
// Insert secure authentication here.
// Make sure to use SSL to secure the connection.
}
</script>
<head runat="server">
<title> HtmlInputText Constructor Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> HtmlInputText Constructor Example </h3>
Enter your password: <br />
<asp:PlaceHolder id="Place" runat="server"/>
<br /><br />
<input type="submit"
value="Submit"
onserverclick="Button_Click"
runat="server"/>
</form>
</body>
</html>
プラットフォーム
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
参照
関連項目
HtmlInputText クラス
HtmlInputText メンバ
System.Web.UI.HtmlControls 名前空間
HtmlInputPassword