简体   繁体   中英

C# dropdownlist change event

<asp:DropDownList runat="server" ID="myListDropDown" CssClass="text" OnSelectedIndexChanged="myListDropDown_Change" />

There's the aspx above

protected void myListDropDown_Change(object sender, EventArgs e)
        {
            //stuff that never gets hit
        }

I put a break point on the myListDropDown method but it never gets hit. Any suggestions?

Set AutoPostBack property of your DropDownList control to true .

<asp:DropDownList AutoPostBack="true" runat="server" ID="myListDropDown" 
                CssClass="text" OnSelectedIndexChanged="myListDropDown_Change" />

DropDownList的Autopostback属性需要设置为“true”。

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