ASP:OnTextChanged在ddl中没有触发text =“”

时间:2013-07-18 09:50:40

标签: asp.net updatepanel

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>

1 个答案:

答案 0 :(得分:0)

我发现它确实发生的原因 - 当selectIndex = 0时,事件onSelectIndex不会触发。