public void UserSelected(object sender, EventArgs eventArgs) { var listView = sender as ListView; var user = new UserBO { Id = (int)listView.SelectedValue }; var contest = new ContestBO { Id = (int)Session["contestId"] }; ParticipationFormView.DataSource = new List <ContestParticipantBO>() { new ContestParticipantBO(null, null, user, contest) }; ParticipationFormView.DataBind(); SaveButton.Visible = true; }
public void OnSaveParticipationClicked(object sender, EventArgs args) { var scoreTextBox = ParticipationFormView.FindControl("ScoreTextBox") as TextBox; var placementTextBox = ParticipationFormView.FindControl("PlacementTextBox") as TextBox; // ParticipationFormView.UpdateItem(true); var participant = new ContestParticipantBO( score: int.Parse(scoreTextBox.Text), placement: int.Parse(placementTextBox.Text), user: new UserBO { Id = (int)UserListView.SelectedValue }, contest: new ContestBO { Id = (int)Session["contestId"] } ); var participantList = ParticipationFormView.DataItem as List <ContestParticipantBO>; new ContestWriter().AddParticipation(participant); Response.Redirect("ContestDetails?id=" + Session["contestId"]); }