In one of my web forms, I have the following code:
protected void Page_Load(object sender, EventArgs e)
{
InitializePage();
}
private void InitializePage()
{
PopulateSelectionControls();
//there's some other stuff here, but for the sake of brevity
//just using this as an example
}
private void PopulateSelectionControls()
{
ddlallemployees.Items.Clear();
ddlallemployees.Items.Add("");
//get employee list and sort it by LastNameE
EmployeeList empList = EmployeeManager.GetList();
if (empList != null)
{
empList.Sort(delegate(Employee e1, Employee e2) { return e1.LastNameE.CompareTo(e2.LastNameE); });
foreach (Employee x in empList)
{
ddlallemployees.Items.Add(new ListItem(x.FullNameE, x.EmployeeID.ToString()));
}
}
if (Request.Cookies["language"].Value == "ja-JP") //Japanese
{
//these functions fill in a dropdown list with the values of a specif ...
Go to the complete details ...