protected void Page_Load(object sender, EventArgs e) { Datagridfunctions ds = new Datagridfunctions(); string ty = (string)HttpContext.Current.Session["user_type"]; int tyi; if (ty == "MGR") { tyi = 1; CheckBox2.Visible = false; CheckBox2.Checked = false; } else { tyi = 0; } if (!IsPostBack) { CheckBox1.Checked = false; CheckBox2.Checked = false; DropDownList1.DataSource = ds.getemployeecode(); DropDownList1.DataTextField = "Employee_Code"; DropDownList1.DataValueField = "Employee_Code"; DropDownList1.DataBind(); DataGridEmpCode.DataSource = ds.getactivityemp(DropDownList1.SelectedValue); DataGridEmpCode.DataBind(); } if (CheckBox2.Checked == true && tyi == 0) { Label1.Visible = false; DropDownList1.Visible = false; CheckBox1.Visible = false; DataGridEmpCode.DataSource = null; DataGridEmpCode.DataSource = ds.getactivityown(); DataGridEmpCode.DataBind(); } else { Label1.Visible = true; DropDownList1.Visible = true; CheckBox1.Visible = true; DataGridEmpCode.DataSource = ds.getactivityemp(DropDownList1.SelectedValue); DataGridEmpCode.DataBind(); if (CheckBox1.Checked == true) { hide(Convert.ToInt32(DropDownList2.SelectedValue)); } else { } } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Datagridfunctions ds = new Datagridfunctions(); string selectedemp = DropDownList1.SelectedValue; DataGridEmpCode.DataSource = null; DataGridEmpCode.DataSource = ds.getactivityemp(DropDownList1.SelectedValue); DataGridEmpCode.DataBind(); if (CheckBox1.Checked == true) { hide(Convert.ToInt32(DropDownList2.SelectedValue)); } }