Back to Devexpress

Could not find control 'X' in ControlParameter 'Y'

aspnet-403757-troubleshooting-server-side-issues-could-not-find-control-in-controlparameter.md

latest2.2 KB
Original Source

Could not find control 'X' in ControlParameter 'Y'

  • Jun 21, 2024

Error Description

The error occurs in the following scenario if the ControlParameter.ControlID value is incorrect:

Solution

Make sure the ControlParameter.ControlID value equals a control’s Control.UniqueID property value.

Use the control’s Init event (How To: Use the Init/Load event handler) to find its unique ID and assign it to the ControlParameter.ControlID property.

aspx
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" DataSourceID="AccessDataSource1"  
    ValueType="System.Int32" ValueField="CategoryID" 
    TextField="CategoryName" OnInit="ASPxComboBox1_Init">  
    ...
</dx:ASPxComboBox>
csharp
protected void ASPxComboBox1_Init(object sender, EventArgs e) {  
    ASPxComboBox control = (ASPxComboBox)sender;  
    System.Diagnostics.Debug.WriteLine(control.UniqueID); // It can be ASPxPanel1$ASPxComboBox1, ASPxGridView1$Title$ASPxComboBox1, etc.  
}
vb
Protected Sub ASPxComboBox1_Init(ByVal sender As Object, ByVal e As EventArgs)
    Dim control As ASPxComboBox = CType(sender, ASPxComboBox)
    System.Diagnostics.Debug.WriteLine(control.UniqueID)
End Sub