protected void Page_Load(object sender, EventArgs e)
    {
        ERole.DataSource    = empHandler.GetEmployeeRole();
        ERole.DataTextField = "Role_Name";
        ERole.DataBind();
        EditEmp.Style.Add("display", "none");

        #region EnableFalse
        //Loop through all the control present on the web page/form
        foreach (Control ctrl in form2.Controls)
        {
            //check for all the TextBox controls on the page and clear them
            if (ctrl.GetType() == typeof(TextBox))
            {
                ((TextBox)(ctrl)).Enabled = false;
                if (((TextBox)ctrl).ID == "EID")
                {
                    ((TextBox)ctrl).Enabled = true;
                }
            }
            //check for all the Label controls on the page and clear them
            else if (ctrl.GetType() == typeof(Label))
            {
                ((Label)(ctrl)).Enabled = false;
            }
            //check for all the DropDownList controls on the page and reset it to the very first item e.g. "-- Select One --"
            else if (ctrl.GetType() == typeof(DropDownList))
            {
                ((DropDownList)(ctrl)).Enabled = false;
            }
            //check for all the CheckBox controls on the page and unchecked the selection
            else if (ctrl.GetType() == typeof(CheckBox))
            {
                ((CheckBox)(ctrl)).Checked = false;
            }
            //check for all the CheckBoxList controls on the page and unchecked all the selections
            else if (ctrl.GetType() == typeof(CheckBoxList))
            {
                ((CheckBoxList)(ctrl)).ClearSelection();
            }
            //check for all the RadioButton controls on the page and unchecked the selection
            else if (ctrl.GetType() == typeof(RadioButton))
            {
                ((RadioButton)(ctrl)).Checked = false;
            }
            //check for all the RadioButtonList controls on the page and unchecked the selection
            else if (ctrl.GetType() == typeof(RadioButtonList))
            {
                ((RadioButtonList)(ctrl)).ClearSelection();
            }
        }
        #endregion
    }
 void GenerateId()
 {
     try
     {
         con.Open();
         MySqlDataAdapter sda = new MySqlDataAdapter("SELECT IFNULL(MAX(E_ID),0)+1 FROM Employee", con);
         DataTable        dt  = new DataTable();
         sda.Fill(dt);
         EID.Text            = dt.Rows[0][0].ToString();
         ERole.DataSource    = empHandler.GetEmployeeRole();
         ERole.DataTextField = "Role_Name";
         ERole.DataBind();
         con.Close();
     }
     catch (MySqlException ex)
     {
         Response.Write("<script>alert('" + ex.Message + "')</script>");
     }
 }