// protected void GridViewAllQuestions_PageIndexChanging(object sender, GridViewPageEventArgs e) // { // this.GridViewAllQuestions.PageIndex = e.NewPageIndex; // } // The return type can be changed to IEnumerable, however to support // paging and sorting, the following parameters must be added: // int maximumRows // int startRowIndex // out int totalRowCount // string sortByExpression public IQueryable <Question> GridViewAllQuestions_GetData() { var context = new ExamPreparationPollSystem.Models.PollSystemEntities(); var questions = context.Questions.OrderBy(q => q.Text); return(questions); }
protected void GridViewAllQuestions_SelectedIndexChanged(object sender, EventArgs e) { int questionId = Convert.ToInt32(this.GridViewAllQuestions.SelectedDataKey.Value); var context = new ExamPreparationPollSystem.Models.PollSystemEntities(); var answers = context.Answers.Where(x => x.QuestionId == questionId).ToList(); this.RepeaterAllResultsAnswers.DataSource = answers; this.RepeaterAllResultsAnswers.DataBind(); }
// protected void GridViewAllQuestions_PageIndexChanging(object sender, GridViewPageEventArgs e) // { // this.GridViewAllQuestions.PageIndex = e.NewPageIndex; // } // The return type can be changed to IEnumerable, however to support // paging and sorting, the following parameters must be added: // int maximumRows // int startRowIndex // out int totalRowCount // string sortByExpression public IQueryable<Question> GridViewAllQuestions_GetData() { var context = new ExamPreparationPollSystem.Models.PollSystemEntities(); var questions = context.Questions.OrderBy(q => q.Text); return questions; }