/// <summary>
    /// 删除老师
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btDelTch_Click(object sender, EventArgs e)
    {
        Admin admin = new Admin();

        int length = 0;
        //胡媛媛添加,判断当前有无用户,2010-01-06
        if (GridView1.Rows.Count == 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
           "<script>alert('当前已无任何用户!')</script>");
            return;
        }
        //胡媛媛添加,判断当前有无用户,2010-01-06

        else
        {
            for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
            {
                //建立模板列中CheckBox控件的引用
                CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("chkCheck");
                if (chk.Checked == true)
                {
                    length++;
                }
            }
            if (length == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                           "<script>alert('请先选择要删除的用户,再删除用户!')</script>");
                return;
            }
            int[] iTchIdArray = new int[length];
            int k = 0;
            for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
            {
                //建立模板列中CheckBox控件的引用
                CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("chkCheck");
                if (chk.Checked == true)
                {
                    iTchIdArray[k] = Convert.ToInt32(GridView1.DataKeys[i].Value);
                    k++;
                }
            }

            try
            {
                //btDelTch.Attributes.Add("onclick", "return confirm('确定要删除吗?')");
                admin.DeleteTeacher(iTchIdArray);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('删除成功!')</script>");
                GridViewBind();

            }
            catch
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                     "<script>alert('该教师当前还有教学任务,请在解除其任命课程后再尝试删除!')</script>");
            }
            //胡媛媛添加,去掉全选前面的复选框,2010-01-07
            finally
            {
                if (chkAll.Checked == true)
                {
                    chkAll.Checked = false;
                }
            }
            //胡媛媛添加,去掉全选前面的复选框,2010-01-07
        }
    }