Пример #1
0
    private void BindList()
    {
        DataSet ds = tbll.GetList("1=1 ORDER BY JSSort Desc");

        lbxJS.DataSource     = ds;
        lbxJS.DataTextField  = "j_name";
        lbxJS.DataValueField = "j_id";
        lbxJS.DataBind();
    }
Пример #2
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void PageBind()
    {
        PageBase pb = new PageBase();

        pb.TblName       = "Tunnel_jiaose";
        pb.FldName       = "JSSort";
        pb.ProcedureName = "pagination";
        pb.PageSize      = pageSize;
        if (cuttentPage == 0)
        {
            cuttentPage = pb.PageIndex;
        }
        pb.PageIndex = cuttentPage;
        int count = 0;
        List <Tunnel.Model.Tunnel_jiaose> modelList = new List <Tunnel.Model.Tunnel_jiaose>();

        modelList  = tbll.GetList(pb, ref count); //获取分页结果
        pb.DoCount = 1;
        tbll.GetList(pb, ref count);              //获取总条数


        //数据绑定
        GridView1.DataSource = modelList;
        GridView1.DataBind();

        //数据分页
        MTCPager1.PageSize    = pageSize;
        MTCPager1.RecordCount = count;
        MTCPager1.PageIndex   = cuttentPage;
        if (count <= pb.PageSize)
        {
            MTCPager1.Visible = false;
        }
        else
        {
            MTCPager1.Visible = true;
        }
    }