This documentation is archived and is not being maintained.

ControlParameter Class

Binds the value of a property of a Control to a parameter object.

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

public ref class ControlParameter : public Parameter
public class ControlParameter extends Parameter
public class ControlParameter extends Parameter
Not applicable.

You can use the ControlParameter class to bind the value of a Control property, such as SelectedValue or SelectedIndex, to a parameter used in a parameterized SQL query, business object method, or filtering expression.

The ControlParameter class provides two properties in addition to those inherited from the Parameter class: ControlID and PropertyName. The ControlID property identifies which Control instance to bind to and the PropertyName property identifies the public property of the Control from which the ControlParameter class retrieves a value.

The following code example demonstrates how to use a ControlParameter object to bind data displayed in a ListBox control to the selected value of a DropDownList control in a declarative scenario. The ControlParameter object is added to the SelectParameters collection of the SqlDataSource control on the form, and corresponds to the "@Title" placeholder text in the SelectCommand property.

No code example is currently available or this language may not be supported.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
  <head runat="server">
    <title>ASP.NET Example</title>
    <form id="form1" runat="server">

          <asp:ListItem Selected="True">Sales Representative</asp:ListItem>
          <asp:ListItem>Sales Manager</asp:ListItem>
          <asp:ListItem>Vice President, Sales</asp:ListItem>

          ConnectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;"
          SelectCommand="SELECT LastName FROM Employees WHERE Title = @Title">
              <asp:ControlParameter Name="Title" ControlId="DropDownList1" PropertyName="SelectedValue"/>



  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.


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 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