0

我有一个ddl工作updatePanel正常。但是当我选择第一项 {value:"null",Text:""} 它不会触发。

C#

ddlCat.DataSource = DataBase.GetTable("select ymc_name,ymc_id from Y_MainCat");
        ddlCat.DataTextField = "ymc_name";
        ddlCat.DataValueField = "ymc_id";
        ddlCat.DataBind();
        ddlCat.Items.Insert(0, new ListItem("", "null"));
        ddlCat.SelectedValue = "null";

html:

<asp:DropDownList ID="ddlCat" runat="server" AutoPostBack="True" OnTextChanged="ddlCat_TextChanged"></asp:DropDownList>
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release"></asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                        <asp:DropDownList ID="ddlSubCat0" runat="server"></asp:DropDownList>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="ddlCat" EventName="TextChanged" />
                </Triggers>
            </asp:UpdatePanel>
4

1 回答 1

0

我找到了它发生的原因 - 当selectIndex=0 时,事件onSelectIndex不会触发。

于 2013-07-18T12:17:53.960 回答