Esempio n. 1
0
    protected void dgGroupUser_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        int userID   = Convert.ToInt32(e.Item.Cells[0].Text);
        int rowCount = dgGroupUser.Items.Count;

        if (userDal.DeleteUserFromGroup(userID))
        {
            this.dgGroupUser.DataSource = userDal.GetGroupUser(Convert.ToInt32(ViewState["GroupID"]));
            if (rowCount == 1)
            {
                if (dgGroupUser.CurrentPageIndex != 0)
                {
                    dgGroupUser.CurrentPageIndex = dgGroupUser.CurrentPageIndex - 1;
                }
            }
            this.dgGroupUser.DataBind();
        }
    }