Exemplo n.º 1
0
    protected void GVmyScore_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        if (-2 == e.NewPageIndex)
        { // when click the "GO" Button
            TextBox txtNewPageIndex = null;

            GridViewRow pagerRow = theGrid.BottomPagerRow;

            if (null != pagerRow)
            {
                txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox;   // refer to the TextBox with the NewPageIndex value
            }

            if (null != txtNewPageIndex)
            {
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
            }
        }
        else
        {  // when click the first, last, previous and next Button
            newPageIndex = e.NewPageIndex;
        }

        // check to prevent form the NewPageIndex out of the range
        newPageIndex      = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex      = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;
        theGrid.PageIndex = newPageIndex;
        GVmyScore.DataBind();
    }
Exemplo n.º 2
0
    private void ShowMySquiz()
    {
        string mySnum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString();

        LearnSite.BLL.Students bll = new LearnSite.BLL.Students();
        LabelSquiz.Text = bll.MySquiz(mySnum);
        LearnSite.BLL.Result rbll = new LearnSite.BLL.Result();
        GVmyScore.DataSource = rbll.GetListScore(mySnum);
        GVmyScore.DataBind();
    }
Exemplo n.º 3
0
    private void ShowMySquiz()
    {
        string mySnum = cook.Snum;

        LearnSite.BLL.Students bll = new LearnSite.BLL.Students();
        LabelSquiz.Text = bll.MySquiz(mySnum);
        LearnSite.BLL.Result rbll = new LearnSite.BLL.Result();
        GVmyScore.DataSource = rbll.GetListScore(mySnum);
        GVmyScore.DataBind();
    }