码迷,mamicode.com
首页 > 微信 > 详细

DSC微信投票翻页

时间:2015-04-13 22:32:52      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:

//数据绑定
    public void dlBind(string chatid)
    {
        int curpage = Convert.ToInt32(this.labPage.Text);
        PagedDataSource ps=new PagedDataSource();
        string sql="select id,s.agentname,case when v.votenum is null then 0 when votenum is not null then sum(votenum) end as votenum,case when s.photourl IS NULL then ‘User/UserHeadImage/123.gif‘ else s.photourl end as photourl from staff s left join wxvote v on s.agentname=v.tlname where s.rank in(‘tl‘,‘sup‘) and s.quit is null and s.unit in (select unit from staff where wechatid=‘"+ chatid +"‘) group by id,s.agentname,v.votenum,s.photourl order by id";
        SqlDataAdapter da=new SqlDataAdapter(sql,SqlHelper.mycon);
        DataSet ds=SqlHelper.ExecuteDataset(SqlHelper.mycon,CommandType.Text, sql);
        da.Fill(ds,"vote_table");
        ps.DataSource=ds.Tables["vote_table"].DefaultView;
        ps.AllowPaging=true;
        ps.PageSize=9;
        ps.CurrentPageIndex=curpage-1;
        lnkbtnFst.Enabled = true;
        lnkbtnLast.Enabled = true;
        lnkbtnUp.Enabled = true;
        lnkbtnNext.Enabled = true;
        if(curpage==1)
        {
            this.lnkbtnFst.Enabled=false;
            this.lnkbtnUp.Enabled=false;
        }
        if(curpage==ps.PageCount)
        {
            this.lnkbtnNext.Enabled=false;
            this.lnkbtnLast.Enabled=false;
        }
        this.labLstPage.Text=Convert.ToString(ps.PageCount);
        this.dlContent.DataSource=ps;
        this.dlContent.DataKeyField="id";
        this.dlContent.DataBind();
    }

DSC微信投票翻页

标签:

原文地址:http://www.cnblogs.com/pp521/p/4423406.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!