0

在 aspx 页面上,我有两个下拉控件:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
    <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="dsClients" DataTextField="Client_Name"
        DataValueField="Client_Name" AutoPostBack="True" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged" ondatabound="DropDownList3_DataBound">
    </asp:DropDownList>
    <asp:DropDownList ID="ddQualIDInsert" runat="server" DataSourceID="dsQual" DataTextField="Project_Name"
        DataValueField="Qual_ID">
    </asp:DropDownList>
</ContentTemplate>
<Triggers>
    <asp:AsyncPostBackTrigger ControlID="DropDownList3" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>

在文件后面的代码中,我有代码根据第一个下拉菜单中的选定值更新和重建第二个下拉选项:

protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
   dsQual.Where = "Client_Name = \"" + ((DropDownList)sender).SelectedValue +"\"";
}

有时会填充下拉菜单,但大多会引发错误:状态信息对此页面无效并且可能已损坏。

4

0 回答 0