I have a combobox and it fires event onItemsRequested. In the code, I bring some class objects and convert them to table and bind with combobox. So far so good. but when the data returned is zero then I want to show error message on the screen that combobox is empty because of the errorr... I update the label (id = lblError) during the code i.e. lblError.Text = "blah bla blah...." but it does not get updated on the screeen. I have ajaxmanager on the aspx page and lblError is included under the ajax settings. so I basically I want to update the label during Combobox_ItemRequested event.
RadComboBox rcb = (RadComboBox)sender;
rcb.ClearSelection();
rcb.Text = string.Empty;
rcb.Items.Clear();
rcb.ShowMoreResultsBox = false;
rcb.BackColor = System.Drawing.Color.Empty;
Employee[] lemployee = Employee.Search();
if (lemployee.Length == 0)
{
lblError.Text = "No employee found";
return;
}
else
{
lblError.Text = "";
DataTable dtable = new DataTable();
DataRow orow;
dtable.Columns.Add("empID");
dtable.Columns.Add("name");
dtable.Columns.Add("SortFlag");
dtable.Columns.Add("Address");
foreach (Employee oemp in lEmployee)
{
orow = dtable.NewRow();
orow["empID"] = oemp.empId.ToString();
orow["name"] = oemp.name.Trim();
orow["Address"] = oemp.Address;
orow["SortFlag"] = "2";
dtable.Rows.Add(orow);
}
rcb.DataSource = dtable;
rcb.DataBind();
}