HtmlInputReset Constructores
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Inicializa una nueva instancia de la clase HtmlInputReset.
Sobrecargas
HtmlInputReset() |
Inicializa una nueva instancia de la clase HtmlInputReset con los valores predeterminados. |
HtmlInputReset(String) |
Inicializa una nueva instancia de la clase HtmlInputReset utilizando el tipo de entrada especificado. |
HtmlInputReset()
Inicializa una nueva instancia de la clase HtmlInputReset con los valores predeterminados.
public:
HtmlInputReset();
public HtmlInputReset ();
Public Sub New ()
Ejemplos
En el ejemplo de código siguiente se muestra cómo usar el HtmlInputReset control para restablecer los valores de un formulario de página web.
<%@ 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)
{
// 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 xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlInputReset Example</title>
</head>
<body>
<form id="form1" 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>
<%@ 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 System.EventArgs)
' Define an HtmlInputReset button using the default constructor.
Dim reset1 As New HtmlInputReset()
reset1.ID = "ResetButton1"
reset1.Value = "Reset 1"
' Define an HtmlInputReset button as type "reset".
Dim reset2 As 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.
Dim reset3 As 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)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlInputReset Example</title>
</head>
<body>
<form id="form1" 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>
Comentarios
En la tabla siguiente se muestra el valor de propiedad inicial de una instancia de HtmlInputReset.
Propiedad | Valor |
---|---|
HtmlControl.TagName | Cadena literal "reset". |
Se aplica a
HtmlInputReset(String)
Inicializa una nueva instancia de la clase HtmlInputReset utilizando el tipo de entrada especificado.
public:
HtmlInputReset(System::String ^ type);
public HtmlInputReset (string type);
new System.Web.UI.HtmlControls.HtmlInputReset : string -> System.Web.UI.HtmlControls.HtmlInputReset
Public Sub New (type As String)
Parámetros
- type
- String
El tipo de entrada.
Ejemplos
En el ejemplo de código siguiente se muestra cómo usar el HtmlInputReset control para restablecer los valores de un formulario de página web.
<%@ 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)
{
// 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 xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlInputReset Example</title>
</head>
<body>
<form id="form1" 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>
<%@ 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 System.EventArgs)
' Define an HtmlInputReset button using the default constructor.
Dim reset1 As New HtmlInputReset()
reset1.ID = "ResetButton1"
reset1.Value = "Reset 1"
' Define an HtmlInputReset button as type "reset".
Dim reset2 As 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.
Dim reset3 As 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)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlInputReset Example</title>
</head>
<body>
<form id="form1" 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>
Comentarios
En la tabla siguiente se muestra el valor de propiedad inicial de una instancia de HtmlInputReset.
Propiedad | Valor |
---|---|
HtmlControl.TagName | Valor del parámetro type . |
Establecer el type
parámetro en un valor no reconocido como un elemento HTML válido da como resultado un elemento HTML <input>
<input>
predeterminado como un campo de entrada de texto de una sola línea.