无法在ControlParameter’y’中找到控件’x’
我正在尝试使用listview的下拉列表来过滤结果。
我已经更改了数据源的选择查询,如下所示…
列表视图:
下拉列表:
All Surnames
使用正确的控件名称(完全相同的上限),但加载页面返回无法在ControlParameter’Surnames’中找到控件’DropDownList1’。
我在这里做错了什么建议?
编辑:如果它有帮助,这是堆栈跟踪
[InvalidOperationException: Could not find control 'DropDownList1' in ControlParameter 'Surname'.] System.Web.UI.WebControls.ControlParameter.Evaluate(HttpContext context, Control control) +2107838 System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +50 System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +113 System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +46 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnLoadComplete(EventArgs e) +9010786 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2350
ControlID
需要以包含DropDownList的ContentPlaceHolder
的ID为前缀:
另见: https : //stackoverflow.com/a/5719348/124386
此外,请确保您对兴趣的控制具有runat =“server”。 哎呀。