protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["loginName"] == null)
            {
                //Response.Write("<script>this.parent.location.href='../Default.aspx'</script>");
                Response.Redirect("~/Default.aspx");
                return;
            }
            department dept = new department();

            GridView1.DataSource = dept.SelectAllDepartment();
            GridView1.DataKeyNames = new String[] { "ID" };
            GridView1.DataBind();
        }
Ejemplo n.º 2
0
 protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
 {
     department dept = new department();
     MDepartment objdept = new MDepartment();
     objdept.Name = txtName.Text.Trim().ToString();
     objdept.Duty_description = txtContent.Text.Trim().ToString();
     bool bl = dept.InsertIntoDepartment(objdept);
     if (bl)
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('新建部门成功!');</script>");
     }
     else
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('新建部门失败!');</script>");
     }
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["loginName"] == null)
            {
                //Response.Write("<script>this.parent.location.href='../Default.aspx'</script>");
                Response.Redirect("~/Default.aspx");
                return;
            }

            if (!IsPostBack)
            {
                //imgBtnSave.Attributes.Add("onclick", "GetArea()");
                department dept = new department();
                dlDepartment.DataSource = dept.SelectAllDepartment();
                dlDepartment.DataBind();
                //Page.ClientScript.RegisterArrayDeclaration("IDArray", string.Format("'{0}'", HiddenField1.ClientID));
            }
        }