Juhi
Juhi

Reputation: 270

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.

Upvotes: 1

Views: 147

Answers (4)

Damith
Damith

Reputation: 63105

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

Upvotes: 3

Nagaraj S
Nagaraj S

Reputation: 13484

Set AutoPostBack="true"

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

Upvotes: 0

Rohan
Rohan

Reputation: 703

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

Upvotes: 1

Afnan Ahmad
Afnan Ahmad

Reputation: 2542

Use Property

AutoPostBack="True"

Upvotes: 3

Related Questions