我試圖從另一個下拉列表填充一個下拉列表(過濾數據) 我明白,我想做出一個ScriptManager,但它給我一個錯誤:Asp.net:ScriptManager就不會工作
The control with ID '' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
這是我的代碼:
<td>School</td>
<td>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:DropDownList ID="SchoolRegister" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="SchoolName" DataValueField="ID">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DanielConnectionString %>"
SelectCommand="SELECT * FROM [Schools]"></asp:SqlDataSource>
</td>
</tr>
<tr>
<td>Class</td>
<td>
<asp:ScriptManager ID="ScriptManager2" runat="server" />
<asp:DropDownList ID="ClassRegister" runat="server"
DataSourceID="SqlDataSource2" DataTextField="ClassName" DataValueField="ID">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:DanielConnectionString %>"
SelectCommand="SELECT * FROM [Class] WHERE ([SchoolID] = @SchoolID)">
<SelectParameters>
<asp:ControlParameter ControlID="SchoolRegister" Name="SchoolID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
感謝。
由於某種原因,它不粘貼我在這裏的整個代碼..我會盡力解決這個問題。對不起 – thormayer 2011-12-28 21:20:31