protected void Page_Load(object sender, EventArgs e)
    {
        ErrorMessageLabel.Visible = false;

        if (!IsPostBack)
        {
            // Populate agents into dropdown list.
            try
            {
                CommonService.CommonService commonService =
                    serviceLoader.GetCommon();

                AgentDropDownList.DataSource     = commonService.GetAgentsList();
                AgentDropDownList.DataValueField = "UserId";
                AgentDropDownList.DataTextField  = "UserName";
                AgentDropDownList.DataBind();

                AgentDropDownList.Items.Insert(0, new ListItem("<Select an Agent>", "0"));
            }
            catch (Exception ex)
            {
                ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                ErrorMessageLabel.Visible = true;

                log.Error("Unknown Error", ex);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ErrorMessageLabel.Visible = false;

        if (!IsPostBack)
        {
            // Populate data into dropdown lists.
            try
            {
                CommonService.CommonService commonService =
                    serviceLoader.GetCommon();

                // Agents.
                AgentDropDownList.DataSource     = commonService.GetAgentsList();
                AgentDropDownList.DataValueField = "UserId";
                AgentDropDownList.DataTextField  = "UserName";
                AgentDropDownList.DataBind();

                AgentDropDownList.Items.Insert(0, new ListItem("<All Agents>", "0"));

                // Categories.
                CategoryDropDownList.DataSource =
                    commonService.GetLookups("Design Category");
                CategoryDropDownList.DataValueField = "LookupId";
                CategoryDropDownList.DataTextField  = "Name";
                CategoryDropDownList.DataBind();

                CategoryDropDownList.Items[0].Text = "<All Categories>";

                // Statuses.
                StatusDropDownList.DataSource =
                    commonService.GetLookups("Design Status");
                StatusDropDownList.DataValueField = "LookupId";
                StatusDropDownList.DataTextField  = "Name";
                StatusDropDownList.DataBind();

                StatusDropDownList.Items[0].Text = "<All Statuses>";
            }
            catch (Exception ex)
            {
                ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                ErrorMessageLabel.Visible = true;

                log.Error("Unknown Error", ex);
            }
        }
    }