HtmlInputSubmit コンストラクタ (String)
アセンブリ: System.Web (system.web.dll 内)



Web フォーム ページに HtmlInputText、HtmlInputPassword、および HtmlInputSubmit の各コントロールをプログラムから追加し、単純なログイン画面を作成する方法を次のコード例に示します。この例では、組み込みの HTML コントロールのタイプをオーバーライドする type パラメータにさまざまな値を渡す方法を示します。
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If (IsPostBack) Then ' Add code to process the Login. End If End Sub Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) ' Pass "password" to make the HtmlInput control render a ' password input type. Dim passwordText As HtmlInputPassword = New HtmlInputPassword() passwordText.MaxLength = 20 Placeholder1.Controls.Add(passwordText) ' Pass "submit" to make the HtmlInput control render a ' form submit button. Dim submitButton As HtmlInputSubmit = New HtmlInputSubmit("submit") submitButton.Value = "Log On to System" Placeholder2.Controls.Add(submitButton) End Sub </script> <html > <body> <form id="Form1" runat="server"> <table cellpadding="2"> <tr> <td>Password <asp:placeholder runat="server" id="Placeholder1" /> </td></tr> <tr><td><asp:placeholder runat="server" id="Placeholder2" /> </td></tr> </table> </form> </body> </html>
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void page_load(object sender, EventArgs e) { if (IsPostBack) { // Add code to process the Login. } } protected void Page_Init(object sender, EventArgs e) { // Pass "password" to make the HtmlInput control render a // password input type. HtmlInputPassword passwordText = new HtmlInputPassword(); passwordText.MaxLength = 20; Placeholder1.Controls.Add(passwordText); // Pass "submit" to make the HtmlInput control render a // form submit button. HtmlInputSubmit submitButton = new HtmlInputSubmit("submit"); submitButton.Value = "Log On to System"; Placeholder2.Controls.Add(submitButton); } </script> <html > <body> <form id="Form1" runat="server"> <table cellpadding="2"> <tr> <td>Password <asp:placeholder runat="server" id="Placeholder1" /> </td></tr> <tr><td><asp:placeholder runat="server" id="Placeholder2" /> </td></tr> </table> </form> </body> </html>
<%@ Page Language="VJ#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(Object sender, System.EventArgs e) { if (get_IsPostBack()) { // Add code to process the Login. } } protected void Page_Init(Object sender, EventArgs e) { // Pass "password" to make the HtmlInput control render a // password input type. HtmlInputPassword passwordText = new HtmlInputPassword(); passwordText.set_MaxLength(20); Placeholder1.get_Controls().Add(passwordText); // Pass "submit" to make the HtmlInput control render a // form submit button. HtmlInputSubmit submitButton = new HtmlInputSubmit("submit"); submitButton.set_Value("Log On to System"); Placeholder2.get_Controls().Add(submitButton); } </script> <html > <body> <form id="Form1" runat="server"> <table cellpadding="2"> <tr> <td>Password <asp:placeholder runat="server" id="Placeholder1" /> </td></tr> <tr><td><asp:placeholder runat="server" id="Placeholder2" /> </td></tr> </table> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HtmlInputSubmit コンストラクタ

名前 | 説明 |
---|---|
HtmlInputSubmit () | 既定値を使用して HtmlInputSubmit クラスの新しいインスタンスを初期化します。 |
HtmlInputSubmit (String) | 型を指定して、HtmlInputSubmit クラスの新しいインスタンスを初期化します。 |

HtmlInputSubmit コンストラクタ ()
アセンブリ: System.Web (system.web.dll 内)



既定のコンストラクタを使用して Web フォーム ページに HtmlInputText、HtmlInputPassword、および HtmlInputSubmit の各コントロールをプログラムから追加し、簡単なログイン画面を作成する方法を次のコード例に示します。
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If (IsPostBack) Then ' Add code to process the Login. End If End Sub Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Dim userText As HtmlInputText = New HtmlInputText userText.MaxLength = 20 Placeholder1.Controls.Add(userText) Dim passwordText As HtmlInputPassword = New HtmlInputPassword passwordText.MaxLength = 20 Placeholder2.Controls.Add(passwordText) Dim submitButton As HtmlInputSubmit = New HtmlInputSubmit submitButton.Value = "Submit" Placeholder3.Controls.Add(submitButton) End Sub </script> <html > <body> <form id="Form1" runat="server"> <table cellpadding="2"> <tr> <td>User Name <asp:placeholder runat="server" id="Placeholder1" /> </td></tr> <tr> <td>Password <asp:placeholder runat="server" id="Placeholder2" /> </td></tr> <tr><td><asp:placeholder runat="server" id="Placeholder3" /> </td></tr> </table> </form> </body> </html>
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void page_load(object sender, EventArgs e) { if (IsPostBack) { // Add code to process the Login. } } protected void Page_Init(object sender, EventArgs e) { HtmlInputText userText = new HtmlInputText(); userText.MaxLength = 20; Placeholder1.Controls.Add(userText); HtmlInputPassword passwordText = new HtmlInputPassword(); passwordText.MaxLength = 20; Placeholder2.Controls.Add(passwordText); HtmlInputSubmit submitButton = new HtmlInputSubmit(); submitButton.Value = "Submit"; Placeholder3.Controls.Add(submitButton); } </script> <html > <body> <form runat="server"> <table cellpadding="2"> <tr> <td>User Name <asp:placeholder runat="server" id="Placeholder1" /> </td></tr> <tr> <td>Password <asp:placeholder runat="server" id="Placeholder2" /> </td></tr> <tr><td><asp:placeholder runat="server" id="Placeholder3" /> </td></tr> </table> </form> </body> </html>
<%@ Page Language="VJ#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(Object sender, System.EventArgs e) { if (get_IsPostBack()) { // Add code to process the Login. } } protected void Page_Init(Object sender, EventArgs e) { HtmlInputText userText = new HtmlInputText(); userText.set_MaxLength(20); Placeholder1.get_Controls().Add(userText); HtmlInputPassword passwordText = new HtmlInputPassword(); passwordText.set_MaxLength(20); Placeholder2.get_Controls().Add(passwordText); HtmlInputSubmit submitButton = new HtmlInputSubmit(); submitButton.set_Value("Submit"); Placeholder3.get_Controls().Add(submitButton); } </script> <html > <body> <form runat="server"> <table cellpadding="2"> <tr> <td>User Name <asp:placeholder runat="server" id="Placeholder1" /> </td></tr> <tr> <td>Password <asp:placeholder runat="server" id="Placeholder2" /> </td></tr> <tr><td><asp:placeholder runat="server" id="Placeholder3" /> </td></tr> </table> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- HtmlInputSubmit コンストラクタのページへのリンク