HtmlInputSubmit.HtmlInputSubmit(String) Constructor

Initializes a new instance of the HtmlInputSubmit class using the specified type.

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

public:
HtmlInputSubmit (
	String^ type
)
public HtmlInputSubmit (
	String type
)
public function HtmlInputSubmit (
	type : String
)
Not applicable.

Parameters

type

The input button type.

The following table shows the initial property value for an instance of HtmlInputSubmit.

Property

Value

HtmlControl.TagName

The value of the type parameter.

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.

No code example is currently available or this language may not be supported.
<%@ 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 xmlns="http://www.w3.org/1999/xhtml" >
  <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 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: