DropDownList OnSelectedIndexChanged event never firing
Posted on 2004-08-13
I have read through all the troubleshooting and other tickets posted on EE regarding this problem, however, it is still occuring with my code.
I have the following web form:
<form name="myForm" id="myForm" method="post" RunAt="server">
<asp:DropDownList ID="ddlType" OnSelectedIndexChanged="ddlType_SelectedIndexChanged" AutoPostBack="True" RunAt="server" />
I have the following code:
protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
private void Redirect()
string URL = "modifyAccomodation.aspx?";
if (null == searchTerm)
URL+= "?page=" + Convert.ToString(page-1);
URL+= "?page=" + Convert.ToString(page-1) + "&s=" + searchTerm;
//include ratings and types
if (type > 0)
URL += "&type=" + type;
if (rating > 0)
URL += "&rating=" + rating;
The event NEVER fires!
Does the AutoPostBack attribute have to be set to True for event to fire?
Does it matter where you declare your databinding for the object?
I have also tried declaring event handler in the code as follows:
ddlType.SelectedIndexChanged +=new System.EventHandler(this.ddlType_SelectedIndexChanged);
Really desperate to resolve this ASAP as I have to show client working page tomorrow.