示例#1
0
    private void populateTrainingList()
    {
        TraingDDown.Items.Clear();
        TraingDDown.Items.Add(new ListItem(" -- SELECT --", "-1"));

        DataTable dataTable = null;

        EmployeeManager manage = new EmployeeManager();

        try
        {
            dataTable = manage.getTrainingList();
            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                TraingDDown.DataSource = dataTable;
                TraingDDown.DataValueField = "ID";
                TraingDDown.DataTextField = "Training_name";
                TraingDDown.DataBind();
            }
            else
            {
                clearLabel();
                msgPanel.Visible = true;
                ErroroDIV.Visible = true;
                lblErrorMsg.Text = "Something went wrong with Branch list, please contact your system administrator";
            }
        }      
        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later. 
            LoggerManager.LogError(ex.ToString(), logger);
        }
    }