简体   繁体   中英

SelectedIndexChanged event of DropDownList is not fired

ASPX FILE contain DropDown as Follows:

< asp:DropDownList ID="drpDist" runat="server" CssClass="dropDownStyle" OnSelectedIndexChanged="drpDist_SelectedIndexChanged" TabIndex="6">

In ASPX.CS FILE

protected void drpDist_SelectedIndexChanged(object sender, EventArgs e)
{
}

Please Help me.I can't get why it is not working.

使用财产

AutoPostBack="True"

you need to set AutoPostBack="true"

<asp:DropDownList ID="drpDist" runat="server" AutoPostBack="true">

when you set that property as true, a postback to the server automatically occurs whenever the user changes the selection of the list

You need to set the AutoPostBack="True" property. This will make the page to postback automatically hence firing your event.

设置AutoPostBack="true"

< asp:DropDownList ID="drpDist" runat="server" AutoPostBack="true" CssClass="dropDownStyle" OnSelectedIndexChanged="drpDist_SelectedIndexChanged" TabIndex="6">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM