protected void grdUsers_RowDeleting(object sender, GridViewDeleteEventArgs e) { string userID = e.Keys[0].ToString(); string userName = grdUsers.Rows[e.RowIndex].Cells[2].Text; using (var rm = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new ApplicationDbContext()))) using (var um = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()))) { UserInfoModel userinfo = new UserInfoModel(); userinfo.DeleteUser(userID); grdUsers.DataBind(); } }