ControlParameter.ControlID Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the name of the control that the ControlParameter object binds to.
public:
property System::String ^ ControlID { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.ControlIDConverter))]
public string ControlID { get; set; }
[]
member this.ControlID : string with get, set
Public Property ControlID As String
Property Value
A string that represents the name of a Web server control.
- Attributes
Examples
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.
ASP.NET Example
ASP.NET Example
The following code example demonstrates how to set the ControlID and PropertyName properties to identify the control that a ControlParameter object is bound to. The example populates a ListBox control with values. The SelectedValue property of the ListBox control is used to filter data retrieved by a SqlDataSource control and displayed by a GridView control.
<%@ Page language="c#"%>
ASP.NET Example
<%@ Page language="VB"%>
ASP.NET Example
Remarks
The ControlID property is a required property that identifies the Control instance that the ControlParameter object binds to at run time.
Typically, the ControlID and PropertyName properties are set for the Evaluate method to correctly bind to a control. If you do not set the ControlID property, the Evaluate method throws an ArgumentException exception when called.