Inicializa una nueva instancia sin nombre de la clase
FormParameter.
Espacio de nombres: System.Web.UI.WebControls
Ensamblado: System.Web (en system.web.dll)
Visual Basic (Declaración)
Dim instance As New FormParameter
public function FormParameter ()
Un objeto FormParameter creado con el constructor FormParameter se inicializa con los valores predeterminados en todas sus propiedades. La propiedad FormField se inicializa en String.Empty. Asimismo, la propiedad Name se inicializa en String.Empty, la propiedad Type se inicializa en TypeCode.Object, la propiedad Direction se inicializa en Input y la propiedad DefaultValue se inicializa en null (Nothing en Visual Basic).
Nota: de seguridad |
|---|
| FormParameter no valida el valor pasado por el elemento de formulario de ninguna forma; utiliza el valor sin formato. En la mayoría de los casos, puede validar el valor de FormParameter antes de que lo utilice un control del origen de datos; para ello, controle el evento, por ejemplo Selecting, Updating, Inserting o Deleting, expuesto por el control del origen de datos que esté utilizando. Si el valor del parámetro no pasa las pruebas de validación, puede cancelar la operación de datos estableciendo la propiedad Cancel de la clase CancelEventArgs asociada en true. |
<%@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">
Private Sub Page_Load(sender As Object, e As EventArgs)
' You can add a FormParameter to the AccessDataSource control's
' SelectParameters collection programmatically.
AccessDataSource1.SelectParameters.Clear()
' Security Note: The AccessDataSource uses a FormParameter,
' Security Note: which does not perform validation of input from the client.
' Security Note: To validate the value of the FormParameter,
' Security Note: handle the Selecting event.
Dim formParam As New FormParameter()
formParam.Name="lastname"
formParam.Type=TypeCode.String
formParam.FormField="LastNameBox"
AccessDataSource1.SelectParameters.Add(formParam)
End Sub ' Page_Load
</script>
<html >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:accessdatasource
id="AccessDataSource1"
runat="server"
datasourcemode="DataSet"
datafile="Northwind.mdb"
selectcommand="SELECT OrderID,CustomerID,OrderDate,RequiredDate,ShippedDate
FROM Orders WHERE EmployeeID =
(SELECT EmployeeID FROM Employees WHERE LastName = @lastname)">
</asp:accessdatasource>
<br />Enter the name "Davolio" or "King" in the text box and click the button.
<br />
<asp:textbox
id="LastNameBox"
runat="server" />
<br />
<asp:button
id="Button1"
runat="server"
text="Get Records" />
<br />
<asp:gridview
id="GridView1"
runat="server"
allowsorting="True"
datasourceid="AccessDataSource1" />
</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">
void Page_Load(Object sender, EventArgs e){
// You can add a FormParameter to the AccessDataSource control's
// SelectParameters collection programmatically.
AccessDataSource1.SelectParameters.Clear();
// Security Note: The AccessDataSource uses a FormParameter,
// Security Note: which does not perform validation of input from the client.
// Security Note: To validate the value of the FormParameter,
// Security Note: handle the Selecting event.
FormParameter formParam = new FormParameter();
formParam.Name="lastname";
formParam.Type=TypeCode.String;
formParam.FormField="LastNameBox";
AccessDataSource1.SelectParameters.Add(formParam);
}
</script>
<html >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:accessdatasource
id="AccessDataSource1"
runat="server"
datasourcemode="DataSet"
datafile="Northwind.mdb"
selectcommand="SELECT OrderID,CustomerID,OrderDate,RequiredDate,ShippedDate
FROM Orders WHERE EmployeeID =
(SELECT EmployeeID FROM Employees WHERE LastName = @lastname)">
</asp:accessdatasource>
<br />Enter the name "Davolio" or "King" in the text box and click the button.
<br />
<asp:textbox
id="LastNameBox"
runat="server" />
<br />
<asp:button
id="Button1"
runat="server"
text="Get Records" />
<br />
<asp:gridview
id="GridView1"
runat="server"
allowsorting="True"
datasourceid="AccessDataSource1" />
</form>
</body>
</html>
<%@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">
void Page_Load(Object sender, System.EventArgs e)
{
// You can add a FormParameter to the AccessDataSource control's
// SelectParameters collection programmatically.
accessDataSource1.get_SelectParameters().Clear();
FormParameter formParam = new FormParameter();
formParam.set_Name("lastname");
formParam.set_Type(System.TypeCode.String);
formParam.set_FormField("LastNameBox");
accessDataSource1.get_SelectParameters().Add(formParam);
}//Page_Load
</script>
<html >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="Form1" runat="server">
<asp:accessdatasource
id="accessDataSource1"
runat="server"
datasourcemode="DataSet"
datafile="Northwind.mdb"
selectcommand="SELECT OrderID,CustomerID,OrderDate,RequiredDate,ShippedDate
FROM Orders WHERE EmployeeID = (SELECT EmployeeID FROM Employees WHERE LastName = @lastname)">
</asp:accessdatasource>
<br />Enter the name "Davolio" or "King" in the text box and click the button.
<br />
<asp:textbox
id="LastNameBox"
runat="server" />
<br />
<asp:button
id="Button1"
runat="server"
text="Get Records" />
<br />
<asp:gridview
id="GridView1"
runat="server"
allowsorting="True"
datasourceid="accessDataSource1">
</asp:gridview>
</form>
</body>
</html>
Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter
Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.
.NET Framework
Compatible con: 3.0, 2.0