在设计方面,我有这个:
<asp:DropdownList ID="ddlSystemSubTypeSearch" runat="server" DataSourceID="sdsSystemSubTypes" DataTextField="stSystemSubType" DataValueField="sstSTID" Width="250px"></asp:DropdownList>
关于背后的代码,我有这个:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If Trim(Request.QueryString("SystemSubType")) <> String.Empty Then
Me.ddlSystemSubTypeSearch.DataBind()
Me.ddlSystemSubTypeSearch.SelectedValue = Request.QueryString("SystemSubType").Trim
End If
End If
End Sub
Private Sub ddlSystemSubTypeSearch_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlSystemSubTypeSearch.DataBound
Me.ddlSystemSubTypeSearch.Items.Insert(0, New ListItem("", -1))
End Sub
当我运行程序时,我收到此错误:
&#39; ddlSystemSubTypeSearch&#39;的数据资源ID必须是类型&gt; IDataSource的控件的ID。 ID为#sdsSystemSubTypes&#39;的控件无法找到。
似乎我无法弄清楚代码有什么问题。任何帮助将不胜感激。