Пример #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 (objUser.DeleteUserFromGroup(UserID))
        {
            this.dgGroupUser.DataSource = objUser.GetGroupUser(Convert.ToInt32(ViewState["GroupID"]));
            if (rowCount == 1)
            {
                if (dgGroupUser.CurrentPageIndex == 0)
                {
                }
                else
                {
                    dgGroupUser.CurrentPageIndex = dgGroupUser.CurrentPageIndex - 1;
                }
            }
            this.dgGroupUser.DataBind();
        }
    }