protected void Page_Load(object sender, EventArgs e) { try { if (Convert.ToString(Session["currentusertype"]) != "Administrator") { Response.Redirect("welcome.aspx"); } if (Page.IsPostBack == false) { dropLevel.Items.Clear(); DataTable dt = BusinessAccessLayer.Query("select * from levels order by levelid"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { dropLevel.Items.Add(Convert.ToString(dt.Rows[i]["levelid"])); } dropLevel.SelectedIndex = 0; } else { Response.Redirect("welcome.aspx", false); } int newemployeeid = BusinessAccessLayer.GetNextID("employees", "employeeid"); lblEmployeeID.Text = Convert.ToString(newemployeeid); txtName.Focus(); } } catch (Exception ex) { lblError.Text = "Error: " + ex.Message; } }