不让DropDownList刷新页面,但OnSelectedIndexChanged事件需要触发,怎样实现

时间:2021-03-19 00:00:42
<asp:DropDownList ID="DDL_Type" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DDL_Type_SelectedIndexChanged">
                                </asp:DropDownList>


protected void DDL_Type_SelectedIndexChanged(object sender, EventArgs e)
    {

        if (Convert.ToInt32(this.DDL_Type.SelectedValue) > 0)
        {
            TProductType type = new TProductType("");
            this.DDL_DetaiType.DataSource = type.GetList1(Convert.ToInt16(this.DDL_Type.SelectedValue));
            this.DDL_DetaiType.DataValueField = "FID";
            this.DDL_DetaiType.DataTextField = "FTypeName";
            this.DDL_DetaiType.DataBind();
            UpdatePanelNewPerAssetReg.Update();

        }
    }

不让dropdownlist刷新页面,但是OnSelectedIndexChanged还要触发,怎样实现,请大家帮帮忙

3 个解决方案

#1


使用UpdatePanel控件

#2


dropdownlist在UpdatePanel里边了,可是不行

#3


<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:UpdatePanel ID="" runat="">
<ContentTemplate>
   <asp:DropDownList ID="DDL_Type" runat="server"AutoPostBack="true"OnSelectedIndexChanged="DDL_Type_SelectedIndexChanged">
  </asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>

#1


使用UpdatePanel控件

#2


dropdownlist在UpdatePanel里边了,可是不行

#3


<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:UpdatePanel ID="" runat="">
<ContentTemplate>
   <asp:DropDownList ID="DDL_Type" runat="server"AutoPostBack="true"OnSelectedIndexChanged="DDL_Type_SelectedIndexChanged">
  </asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>