示例#1
0
        public JsonResult GetAllQuestion()
        {
            QuestionBL       bl       = new QuestionBL();
            List <Questions> quesList = bl.GetAllQuestion();

            return(Json(quesList, JsonRequestBehavior.AllowGet));
        }
示例#2
0
    private void BindItemsList()
    {
        questionbl = new QuestionBL();
        questions  = new List <QuestionDTO>();

        questions = questionbl.GetAllQuestion(CurrentPage, 20);

        if (questions != null)
        {
            ViewState["TotalPages"] = questions[1].TotalPage.ToString();

            DataListQuestion.DataSource = questions;
            DataListQuestion.DataBind();

            this.lblPageInfo.Text = "Page " + (CurrentPage) + " of " + questions[1].TotalPage.ToString();

            if (CurrentPage - 1 == 0)
            {
                lbtnPrevious.Enabled = false;
            }
            else
            {
                lbtnPrevious.Enabled = true;
            }

            if (CurrentPage == Convert.ToInt32(ViewState["TotalPages"]))
            {
                lbtnNext.Enabled = false;
            }
            else
            {
                lbtnNext.Enabled = true;
            }

            if (CurrentPage == 1)
            {
                lbtnFirst.Enabled = false;
            }
            else
            {
                lbtnFirst.Enabled = true;
            }

            if (CurrentPage == Convert.ToInt32(ViewState["TotalPages"]))
            {
                lbtnLast.Enabled = false;
            }
            else
            {
                lbtnLast.Enabled = true;
            }
        }
    }