Initializes a new instance of the HtmlInputSubmit class using the specified type.
Namespace:
System.Web.UI.HtmlControls
Assembly:
System.Web (in System.Web.dll)
Visual Basic (Declaration)
Public Sub New ( _
type As String _
)
Dim type As String
Dim instance As New HtmlInputSubmit(type)
public HtmlInputSubmit(
string type
)
public:
HtmlInputSubmit(
String^ type
)
public function HtmlInputSubmit(
type : String
)
The following table shows the initial property value for an instance of HtmlInputSubmit.
The following code example demonstrates how to programmatically add HtmlInputText, HtmlInputPassword, and HtmlInputSubmit controls to a Web Forms page to create a simple login screen. This example demonstrates how you can pass various values for the type parameter, which overrides the intrinsic type of the HTML control.
<%@ 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 >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<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 >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference