ControlParameter in FormView

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I have a ControlParameter inside a FormView Template and an SqlDataSource
ControlParameter. I am referring to the control by name but I am getting
the following error.

Message: Could not find control 'ddlCountryRegionCode' in ControlParameter
'CountryCode'.

Stack Trace:
at System.Web.UI.WebControls.ControlParameter.Evaluate(HttpContext
context, Control control)
at System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context,
Control control)
at System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext
context, Control control)
at
System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object
sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnLoadComplete(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Below is the asp info from the page. Any help is greatly appreciated.
-David

<asp:DropDownList ID="ddlCountryRegionCode" runat="server"
DataSourceID="SqlCountryRegion"
DataTextField="Country" DataValueField="CountryRegionCode"
SelectedValue='<%# Bind("CountryRegionCode") %>'
AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlCountryRegion" runat="server"
ConnectionString="<%$ ConnectionStrings:RepSearchConnectionString %>"
SelectCommand="SELECT [CountryRegionCode], [Country] FROM
[CountryRegion] ORDER BY [Country]">
</asp:SqlDataSource>

<asp:DropDownList ID="ddlStateProvinceID" runat="server"
DataSourceID="SqlStateProvince"
DataTextField="StateProvince" DataValueField="StateProvinceID"
SelectedValue='<%# Bind("StateProvinceID") %>'
AppendDataBoundItems="true">
<asp:ListItem Value="0" Text=""></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlStateProvince" runat="server"
ConnectionString="<%$ ConnectionStrings:RepSearchConnectionString %>"
SelectCommand="SELECT [StateProvinceID], [CountryRegionCode],
[StateProvince] FROM [StateProvince] WHERE ([CountryRegionCode] =
@CountryCode) ORDER BY [StateProvince]">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCountryRegionCode"
DefaultValue="US" Name="CountryCode" PropertyName="SelectedValue"
Type="string" />
</SelectParameters>
</asp:SqlDataSource>
 
Back
Top