HtmlInputSubmit Class
Assembly: System.Web (in system.web.dll)
The HtmlInputSubmit class is derived from the HtmlInputButton class and is used to create a button control on a Web page that submits a form. The HtmlInputSubmit control is often used with the HtmlInputReset control, which resets form controls to their initial values.
For a list of initial property values for an instance of HtmlInputSubmit, see the HtmlInputSubmit constructor.
| Topic | Location |
|---|---|
| How to: Add HTML Server Controls to a Web Page Using ASP.NET Syntax | Building ASP .NET Web Applications |
| How to: Set HTML Server Control Properties Programmatically | Building ASP .NET Web Applications |
| How to: Add HTML Server Controls to a Web Page Using ASP.NET Syntax | Building ASP .NET Web Applications |
| How to: Set HTML Server Control Properties Programmatically | Building ASP .NET Web Applications |
The following code example demonstrates how to use the <input type=submit> HTML control declaratively on a Web Forms page.
<%@ Page Language="VJ#" %>
<!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" >
<body>
<form id="Form1" runat="server">
<p></p><div>Username</div> <br />
<input type="text" runat="server" />
<p></p><div>Password</div> <br />
<input type="password" runat="server" />
<p></p><input type="submit" runat="server" value="Submit" />
</form>
</body>
</html>
The following code example demonstrates how to add the same HTML control programmatically during a call to the Page_Load method.
<%@ 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 xmlns="http://www.w3.org/1999/xhtml" >
<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>
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
System.Web.UI.Control
System.Web.UI.HtmlControls.HtmlControl
System.Web.UI.HtmlControls.HtmlInputControl
System.Web.UI.HtmlControls.HtmlInputButton
System.Web.UI.HtmlControls.HtmlInputSubmit
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
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.