コード例 #1
0
    protected void Rebind()
    {
        DataSet DepartmentName_dataset = DepartmentInfoEx.SelectAllDepartName();

        GridViewDepartment.DataSource = DepartmentName_dataset;
        GridViewDepartment.DataBind();
    }
コード例 #2
0
    protected void bt_addDepartmentName_Click(object sender, EventArgs e)
    {
        string sDepartmentname = txtDepartmentName.Text.ToString();

        if (!DepartmentInfoEx.AddDepartName(sDepartmentname))
        {
            ERRORMessage.Text = "插入失败!";
            return;
        }
        Rebind();
    }
コード例 #3
0
    protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int    index    = e.RowIndex;
        String SelectId = GridViewDepartment.DataKeys[index].Value.ToString().Trim();

        //ERRORMessage.Text = SelectId;

        if (!DepartmentInfoEx.DeleteDepartName(SelectId))
        {
            ERRORMessage.Text = "删除失败!";
            return;
        }
        Rebind();
    }
コード例 #4
0
    protected void ControlInitalize()
    {
        DataSet dtDepartmentName = DepartmentInfoEx.SelectAllDepartName();

        for (int i = 0; i != dtDepartmentName.Tables[0].Rows.Count; i++)
        {
            ListItem ItemDepartmentName = new ListItem();
            ItemDepartmentName.Value = dtDepartmentName.Tables[0].Rows[i][0].ToString();
            ItemDepartmentName.Text  = dtDepartmentName.Tables[0].Rows[i][1].ToString();
            DropDownListDepartment.Items.Add(ItemDepartmentName);
        }

        DataSet dtWorkUnitName = WorkUnitInfoEx.SelectAllWorkUnitName();

        for (int i = 0; i != dtWorkUnitName.Tables[0].Rows.Count; i++)
        {
            ListItem ItemWorkUntiName = new ListItem();
            ItemWorkUntiName.Value = dtWorkUnitName.Tables[0].Rows[i][0].ToString();
            ItemWorkUntiName.Text  = dtWorkUnitName.Tables[0].Rows[i][1].ToString();
            DropDownListWorkUnit.Items.Add(ItemWorkUntiName);
        }
    }