ControlParameter in FormView

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top