For some reason my combobox will not fire its SelectedIndexChanged method. I created another combobox just below it without any header or item templates and its selectedindexchanged works just fine. Can anyone tell me why the code below is not working?
<
telerik:RadComboBox
ID
=
"employeeList"
runat
=
"server"
Height
=
"200px"
Width
=
"300px"
DropDownWidth
=
"300px"
HighlightTemplatedItems
=
"true"
CausesValidation
=
"false"
EnableLoadOnDemand
=
"true"
EmptyMessage
=
"Choose and Employee"
Filter
=
"StartsWith"
AutoPostBack
=
"true"
onitemsrequested
=
"employeeList_ItemsRequested"
onselectedindexchanged
=
"employeeList_SelectedIndexChanged"
>
<
HeaderTemplate
>
<
table
>
<
tr
>
<
td
style
=
"width: 150px;"
>
Employee Name
</
td
>
<
td
style
=
"width: 200px;"
>
Employee UserName
</
td
>
</
tr
>
</
table
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
table
style
=
"width: 300px"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
style
=
"width: 150px"
>
<%# DataBinder.Eval(Container, "Attributes['Name']") %>
</
td
>
<
td
style
=
"width: 150px"
>
<%# DataBinder.Eval(Container, "Attributes['ID']") %>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
protected void employeeList_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
SqlConnection connection = new SqlConnection(GetConnectionString());
connection.Open();
SqlCommand cmd = new SqlCommand();
//DataTable dt = new DataTable();
cmd = new SqlCommand("DisplayEmployeeNamesForDropDown", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@ManagerID", TimeSlayer.ActiveDirectoryUser.UserName(User)));
//SqlDataAdapter da = new SqlDataAdapter(cmd);
//da.Fill(dt);
SqlDataReader dr;
dr = cmd.ExecuteReader();
//populate combo box for goal review form
//foreach (DataRow row in dt.Rows)
//{
// employeeComboBox.Items.Add(new RadComboBoxItem(row[1].ToString(), row[0].ToString()));
//}
foreach (IDataRecord record in dr)
{
RadComboBoxItem item = new RadComboBoxItem();
//item.Text =
//item.Value = record["Name"].ToString();
item.Attributes.Add("ID", record["ID"].ToString());
item.Attributes.Add("Name", record["Name"].ToString());
employeeList.Items.Add(item);
item.DataBind();
}
cmd.Connection.Close();
cmd.Connection.Dispose();
}