|
Este artículo proviene de un motor de traducción automática. Mueva el puntero sobre las frases del artículo para ver el texto original. Más información.
|
Traducción
Original
|
Parameter (Clase)
System.Web.UI.WebControls.Parameter
System.Web.DynamicData.DynamicControlParameter
System.Web.DynamicData.DynamicQueryStringParameter
System.Web.UI.WebControls.ControlParameter
System.Web.UI.WebControls.CookieParameter
System.Web.UI.WebControls.FormParameter
System.Web.UI.WebControls.ProfileParameter
System.Web.UI.WebControls.QueryStringParameter
System.Web.UI.WebControls.RouteParameter
System.Web.UI.WebControls.SessionParameter
Espacio de nombres: System.Web.UI.WebControls
Ensamblado: System.Web (en System.Web.dll)
El tipo Parameter expone los siguientes miembros.
| Nombre | Descripción | |
|---|---|---|
![]() | Parameter() | |
![]() | Parameter(Parameter) | |
![]() | Parameter(String) | |
![]() | Parameter(String, DbType) | |
![]() | Parameter(String, TypeCode) | |
![]() | Parameter(String, DbType, String) | |
![]() | Parameter(String, TypeCode, String) |
| Nombre | Descripción | |
|---|---|---|
![]() | ConvertEmptyStringToNull | |
![]() | DbType | |
![]() | DefaultValue | |
![]() | Direction | |
![]() | IsTrackingViewState | |
![]() | Name | |
![]() | Size | |
![]() | Type | |
![]() | ViewState |
| Nombre | Descripción | |
|---|---|---|
![]() | Clone | |
![]() ![]() | ConvertDbTypeToTypeCode | |
![]() ![]() | ConvertTypeCodeToDbType | |
![]() | Equals(Object) | |
![]() | Evaluate | |
![]() | Finalize | |
![]() | GetDatabaseType | |
![]() | GetHashCode | |
![]() | GetType | |
![]() | LoadViewState | |
![]() | MemberwiseClone | |
![]() | OnParameterChanged | |
![]() | SaveViewState | |
![]() | SetDirty | |
![]() | ToString | |
![]() | TrackViewState |
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | ICloneable.Clone | |
![]() ![]() | IStateManager.IsTrackingViewState | Infraestructura. |
![]() ![]() | IStateManager.LoadViewState | Infraestructura. |
![]() ![]() | IStateManager.SaveViewState | Infraestructura. |
![]() ![]() | IStateManager.TrackViewState | Infraestructura. |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="form1" runat="server"> <p><asp:dropdownlist id="DropDownList1" runat="server" autopostback="True"> <asp:listitem selected="True">Sales Representative</asp:listitem> <asp:listitem>Sales Manager</asp:listitem> <asp:listitem>Vice President, Sales</asp:listitem> </asp:dropdownlist></p> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:MyNorthwind%>" selectcommand="SELECT LastName FROM Employees WHERE Title = @Title"> <selectparameters> <asp:controlparameter name="Title" controlid="DropDownList1" propertyname="SelectedValue"/> </selectparameters> </asp:sqldatasource> <p><asp:listbox id="ListBox1" runat="server" datasourceid="SqlDataSource1" datatextfield="LastName"> </asp:listbox></p> </form> </body> </html>
<%@ Page Language="C#" CodeFile="param1acs.aspx.cs" Inherits="param1acs_aspx" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList runat="server" AutoPostBack="True" id="DropDownList1"> <asp:ListItem Value="USA">USA</asp:ListItem> <asp:ListItem Value="UK">UK</asp:ListItem> </asp:DropDownList> <asp:DataGrid runat="server" id="DataGrid1" /> </div> </form> </body> </html>
public partial class param1acs_aspx : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { SqlDataSource sqlSource = new SqlDataSource( ConfigurationManager.ConnectionStrings["MyNorthwind"].ConnectionString, "SELECT FirstName, LastName FROM Employees WHERE Country = @country;"); ControlParameter country = new ControlParameter(); country.Name = "country"; country.Type = TypeCode.String; country.ControlID = "DropDownList1"; country.PropertyName = "SelectedValue"; // If the DefaultValue is not set, the DataGrid does not // display anything on the first page load. This is because // on the first page load, the DropDownList has no // selected item, and the ControlParameter evaluates to // String.Empty. country.DefaultValue = "USA"; sqlSource.SelectParameters.Add(country); // Add the SqlDataSource to the page controls collection. Page.Controls.Add(sqlSource); DataGrid1.DataSource = sqlSource; DataGrid1.DataBind(); } }
namespace Samples.AspNet { using System; using System.ComponentModel; using System.Security.Permissions; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)] public class StaticParameter : Parameter { public StaticParameter() { } // The StaticParameter(string, object) constructor // initializes the DataValue property and calls the // Parameter(string) constructor to initialize the Name property. public StaticParameter(string name, object value) : base(name) { DataValue = value; } // The StaticParameter(string, TypeCode, object) constructor // initializes the DataValue property and calls the // Parameter(string, TypeCode) constructor to initialize the Name and // Type properties. public StaticParameter(string name, TypeCode type, object value) : base(name, type) { DataValue = value; } // The StaticParameter copy constructor is provided to ensure that // the state contained in the DataValue property is copied to new // instances of the class. protected StaticParameter(StaticParameter original) : base(original) { DataValue = original.DataValue; } // The Clone method is overridden to call the // StaticParameter copy constructor, so that the data in // the DataValue property is correctly transferred to the // new instance of the StaticParameter. protected override Parameter Clone() { return new StaticParameter(this); } // The DataValue can be any arbitrary object and is stored in ViewState. public object DataValue { get { return ViewState["Value"]; } set { ViewState["Value"] = value; } } // The Value property is a type safe convenience property // used when the StaticParameter represents string data. // It gets the string value of the DataValue property, and // sets the DataValue property directly. public string Value { get { object o = DataValue; if (o == null || !(o is string)) return String.Empty; return (string)o; } set { DataValue = value; OnParameterChanged(); } } // The Evaluate method is overridden to return the // DataValue property instead of the DefaultValue. protected override object Evaluate(HttpContext context, Control control) { if (context.Request == null) return null; return DataValue; } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (no se admite el rol Server Core), Windows Server 2008 R2 (se admite el rol Server Core con SP1 o versiones posteriores; no se admite Itanium)
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

