private void DiaplayQuestion(int questionID) { QuestionsBI questionBI = new QuestionsBI(); QuestionsEntity entity = questionBI.Read(questionID); txtSrNo.Text = Convert.ToString(entity.Sno); txtQuestion.Text = entity.Question; rdoAnswerType.SelectedValue = entity.AnswerType; }
protected void gvQuestions_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "E") { SessionManager.QuestionID = Convert.ToInt32(e.CommandArgument); DiaplayQuestion(SessionManager.QuestionID); } if (e.CommandName == "D") { SessionManager.QuestionID = Convert.ToInt32(e.CommandArgument); QuestionsBI questionBI = new QuestionsBI(); questionBI.Delete(SessionManager.QuestionID); LoadQuestion(); } }
private void SaveQuestion() { QuestionsEntity entity = new QuestionsEntity(); if (SessionManager.QuestionID != null) { entity.QuestionID = SessionManager.QuestionID; } entity.Sno = Convert.ToInt32(txtSrNo.Text); entity.Question = txtQuestion.Text; entity.AnswerType = rdoAnswerType.SelectedValue; QuestionsBI questionsBI = new QuestionsBI(); questionsBI.InsertQuestion(entity); //txtSrNo.Text = entity.Sno; //txtQuestion = entity.Question; //rdoAnswerType.SelectedValue = entity. }
private void LoadQuestion() { QuestionsBI questionBI = new QuestionsBI(); List<QuestionsEntity> list = questionBI.ReadList(); gvQuestions.DataSource = list; gvQuestions.DataBind(); }