Hi,
I,m using RadComboBox with multi columns like “EmployeeStatus” & “StatusID” and applying search on both the columns. Once I have selected an employee status, saving StatusID of that status in the database. Its working fine. But my problem is that if I,m loading that statusID from the database and again binding radcomboBox with this id and doing selected true for that id, its not working.
CS Code:
protected void cboMEStatus_OnItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
List<bocWFEmployeeStatusCollection> listEmpStatus = objlibWFDALController.GetEmployeeStatus();
if (listEmpStatus != null)
{
var status = Enumerable.Empty<bocWFEmployeeStatusCollection>();
if (utlTypeChecking.IsNumeric(temp))
{
status = from data in listEmpStatus
where data.Employee_Status_ID.ToString().StartsWith(temp)
select data;
}
else
{
status = from data in listEmpStatus
where data.Employee_Status_Value.StartsWith(temp, StringComparison.OrdinalIgnoreCase)
select data;
}
foreach (var item in status)
{
RadComboBoxItem radItem = new RadComboBoxItem();
radItem.Text = item.Employee_Status_Value;
radItem.Value = item.Employee_Status_ID.ToString();
radItem.Attributes.Add("Employee_Status_ID", item.Employee_Status_ID.ToString());
cboMEStatus.Items.Add(radItem);
radItem.DataBind();
}
}
}
HTML Code:
<HeaderTemplate>
<table style="width: 200px" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 100px;">
Status Description
</td>
<td style="width: 80px;">
Status ID
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="0" style="width: 200px" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 100px;">
<%# DataBinder.Eval(Container, "Text")%>
</td>
<td style="width: 80px;">
<%# DataBinder.Eval(Container, "Attributes['Employee_Status_ID']")%>
</td>
</tr>
</table>
</ItemTemplate>
********************************************************
cboMEStatus.FindItemByValue(statusRef.ToString()).Selected = true;
where statusRef.ToString() is coming from database.
How to Show selected text in combobox with this id.
Please Help
Regards
Ravi