Export (0) Print
Expand All

HtmlInputReset Class

Note: This class is new in the .NET Framework version 2.0.

Allows programmatic access to the HTML <input type=reset> element on the server.

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

public class HtmlInputReset : HtmlInputButton
public class HtmlInputReset extends HtmlInputButton
public class HtmlInputReset extends HtmlInputButton

The HtmlInputReset class is derived from the HtmlInputButton class and is used to create a button control on a Web page that resets form controls to their initial values. The HtmlInputReset control is often used with the HtmlInputSubmit control, which is used to create a button control that submits the form.

For a list of initial property values for an instance of HtmlInputReset, see the HtmlInputReset constructor.

The following code example demonstrates how to use the HtmlInputReset control to reset the values of a form on a Web page.


<%@ Page Language="C#" %>

 <script runat="server">

     protected void Page_Load(object sender, EventArgs e)
     {
       // Define an HtmlInputReset button using the default constructor.
       HtmlInputReset reset1 = new HtmlInputReset();
       reset1.ID = "ResetButton1";
       reset1.Value = "Reset 1";
       
       // Define an HtmlInputReset button as type "reset".
       HtmlInputReset reset2 = new HtmlInputReset("reset");
       reset2.ID = "ResetButton2";
       reset2.Value = "Reset 2";

       // Define an HtmlInputReset button as custom type "custom".
       // This is not a valid HTML input type so a standared input
       // field will be displayed.
       HtmlInputReset reset3 = new HtmlInputReset("custom");
       reset3.ID = "ResetButton3";
       reset3.Value = "Reset 3";
       
       // Clear the PlaceHolder control and add the Reset buttons to it.
       PlaceHolder.Controls.Clear();
       PlaceHolder.Controls.Add(reset1);
       PlaceHolder.Controls.Add(new LiteralControl("<br>"));
       PlaceHolder.Controls.Add(reset2);
       PlaceHolder.Controls.Add(new LiteralControl("<br>"));
       PlaceHolder.Controls.Add(reset3);
       
     }
</script>

<html> 

<head>

  <title>HtmlInputReset Example</title>

</head>

<body>

   <form runat="server">

      <h3> HtmlInputReset Example </h3>

      <asp:PlaceHolder id="PlaceHolder"
                       runat="server">
      </asp:PlaceHolder>
      
      <br />

      Change the text in the input field and then click 
      "Reset 1" or "Reset 2" to change it back to its initial
      value.

   </form>

</body>

</html>


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft