Visual Studio 2008, C#, SQL Server 2005
I swear this was working before.
I have a drop down list of all the users in a particular role.
// Get the selected role
string selectedRoleName = "Manager";
// Get the list of usernames that belong to the role
string[] usersBelongingToRole = Roles.GetUsersInRole(selectedRoleName);
// Bind the list of users to the GridView
ddlDeptManager.DataSource = usersBelongingToRole;
ddlDeptManager2.DataSource = usersBelongingToRole;
ddlDeptManager.DataBind();
ddlDeptManager2.DataBind();
The problem is, when I try to access the selected index/item/value, it always selected the first name in the list and never the one that the dropdownlist has been changed to. None of the following solves the problem:
d.DeptManager = ddlDeptManagers.SelectedItem.Text;
d.DeptManager = ddlDeptManagers.SelectedIndex.ToString();
d.DeptManager = d ...
Go to the complete details ...