As the title says I am experiencing a problem where the SelectedIndexChanged Event of a drop down list will not fire under any circumstances. I have spent several hours looking for the solution and trying different things. Some places suggest that this is a known bug and provide work-arounds but none of them have worked for me up until this point.
The drop down in question is built here:
<tr>
<td>
Select Project
</td>
<td>
<asp:DropDownList ID="ddlProjects" runat="server"
OnSelectedIndexChanged="ddlProjects_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
</td>
</tr>
This seems standard enough to me so I do not know where it could be going wrong.
EDIT (sorry I am new to this):
Code Behind:
protected void ddlProjects_SelectedIndexChanged(object sender, EventArgs e)
{
List<DashBoardImport> selectedProject = DBI.GetProject(Convert.ToInt32(ddlProjects.SelectedValue));
foreach (var proj in selectedProject)
{
txtProjectName.Text = proj.ProjectName;
this.ddlStatus.SelectedIndex = proj.Status.Equals("Current") ? 0 : 1;
var priority = proj.Priority.PriorityName;
if (priority.Equals("Low"))
{
ddlPriority.SelectedIndex = 0;
}
else if (priority.Equals("Medium"))
{
ddlPriority.SelectedIndex = 1;
}
else if (priority.Equals("High"))
{
ddlPriority.SelectedIndex = 2;
}
//txtRank.Text = proj.ProjectRank.ToString();
txtBusinessArea.Text = proj.BusinessArea.BusinessAreaName;
txtRequester.Text = proj.Requestor;
}
//selectedIndex.Value = ddlProjects.SelectedIndex.ToString();
}
There is no javascript even touching this function in anyway. I have removed it to try and take things back to basics so to speak. I have put break points in the page_load in the onselectedindexchanged function and in several other places and the event is never fired and the selected index is never changed from 0.
Edit2: Here is the code several people have asked for.
<%@ Page Title="Future Projects" Language="C#" MasterPageFile="~/Site.Master" EnableEventValidation="true"
AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ITDashBoard.Web.Default" %>