protected void btnPlayer_Click(object sender, EventArgs e) { using (AttendancesController ac = new AttendancesController()) { ClickablePanel panel = (ClickablePanel)sender; ac.AddNew(new Attendance() { CreateDate = DateTime.Now.ToUniversalTime(), CreateUserID = CurrentUser.UserID, IsActive = true, PlayerID = panel.PlayerID, TeamScheduleID = TeamScheduleID.Value }); panel.CssClass += " success"; panel.IsDisabled = true; } }