注册 登录
编程论坛 ASP技术论坛

关于asp.net代码小问题

ruirui112811 发布于 2013-06-07 22:09, 651 次点击
求助一下代码是啥意思:
public void Band()
    {
        string type = ext_string(Request.QueryString["ID"]);

        try
        {
            this.lbClassName.Text = db1.GetModel(type).ClassName;
        }
        catch
        {
            this.lbClassName.Text = "新闻中心";
        }

        DataSet ds = new DataSet();
        string sqlwhere = " 1=1 ";
        sqlwhere += type != "" ? " and  ClassID='" + type + "'" : "";
        ds = db.GetList(sqlwhere);
        AspNetPager1.RecordCount = ds.Tables.Count;
        
        PagedDataSource pdsList = new PagedDataSource();
        pdsList.DataSource = ds.Tables[0].DefaultView;
        pdsList.AllowPaging = true;
        pdsList.PageSize = AspNetPager1.PageSize;
        pdsList.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        
        this.replist.DataSource = pdsList;
        this.replist.DataBind();
    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        Band();
    }
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
    }
}
1 回复
#2
yinje20052013-06-24 22:32
.net的问题跑到ASP论坛里面来发了,楼主以后要注意哦,这里可是ASP的哦!你上面的那段代码就是一个分页功能的实现,并实现数据的绑定的操作,并没有其他的东西在。
1