Sunday, July 20, 2008

Could not find control 'ddlColor' in ControlParameter 'ColorID'.

Here I'm using a DetailView to update or insert into a SQLDataSource. However, the control parameters are not found for my dropdownlist. The error message is: Could not find control 'ddlColor' in ControlParameter 'ColorID'. Here's an example of my UpdateParamenters.

<updateparameters>
<asp:controlparameter defaultvalue="0" type="Int16" propertyname="SelectedValue" controlid="ddlColor" name="ColorID">
</updateparameters>

SOLUTION
Since the page cannot find the control, you have to specify that the control is inside the DetailsView. Use DetailsView1$ddlColor for the ControlID. Here's the correct syntax.

<updateparameters>
<asp:controlparameter defaultvalue="0" type="Int16" propertyname="SelectedValue" controlid="DetailsView1$ddlColor" name="ColorID">
</updateparameters>

No comments: