protected void Add_Click(object sender, EventArgs e) { PollAnswersDb ans = new PollAnswersDb() { PollAnswer = this.tbAddPollAnswer.Text }; PollQuestionDb pq = new PollQuestionDb() { IdPollQuestion = Convert.ToInt32(this.LabelPollQuestionId.Text) }; this.DropDownListPollAnswers.DataSource = OperationManager.Singleton.izvrsiOperaciju(new OpPollInsertOnlyAnswer() { Answer = ans, PollQuestion = pq }).DbItems.Cast <PollAnswersDb>().ToArray(); this.DropDownListPollAnswers.DataTextField = "PollAnswer"; this.DropDownListPollAnswers.DataValueField = "IdPollAnswer"; this.DropDownListPollAnswers.DataBind(); }
protected void tbDeletePollAnswer_Click(object sender, EventArgs e) { PollAnswersDb ans = new PollAnswersDb() { IdPollAnswer = Convert.ToInt32(this.DropDownListPollAnswers.SelectedValue) }; PollQuestionDb pq = new PollQuestionDb() { IdPollQuestion = Convert.ToInt32(this.LabelPollQuestionId.Text) }; this.DropDownListPollAnswers.DataSource = OperationManager.Singleton.izvrsiOperaciju(new OpPollDeleteOnlyAnswer() { Answer = ans, PollQuestion = pq }).DbItems.Cast <PollAnswersDb>().ToArray(); this.DropDownListPollAnswers.DataTextField = "PollAnswer"; this.DropDownListPollAnswers.DataValueField = "IdPollAnswer"; this.DropDownListPollAnswers.DataBind(); if (this.DropDownListPollAnswers.Items.Count > 0) { this.tbPollAnswerUpdate.Text = this.DropDownListPollAnswers.Items[0].Text; } }