Blake Rogers
Blake Rogers

Reputation: 647

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?

Upvotes: 21

Views: 80591

Answers (2)

SquidScareMe
SquidScareMe

Reputation: 3218

Autopostback property of the DropDownList needs to be set to 'true'.

Upvotes: 6

Bala R
Bala R

Reputation: 108957

Set AutoPostBack property of your DropDownList control to true.

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

Upvotes: 38

Related Questions