未将对象设置到实例。
虽然我问题这个问题,但不是太明白。这次想问的清楚一点。
DataList中的FooterTemplate中有一分页控件,
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" onpagechanging="AspNetPager1_PageChanging">
</webdiyer:AspNetPager>datalist的绑定代码如下:
protected void dlDataBind(string id)
{
...
int count = comment.GetCommentCount(id);//总页数 DataSet ds = comment.GetCommentbyId(id);//数据源
DataView dv = ds.Tables[0].DefaultView;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dv;
pds.AllowPaging = true;
this.dlComment.DataSource = ds;
this.dlComment.DataBind(); AspNetPager pager = (AspNetPager)this.dlComment.FindControl("AspNetPager1");//分页控件,此处出错
pager.PageSize = 3;
pager.RecordCount = count;
pds.CurrentPageIndex = pager.CurrentPageIndex - 1;
pds.PageSize = pager.PageSize;
}
虽然我问题这个问题,但不是太明白。这次想问的清楚一点。
DataList中的FooterTemplate中有一分页控件,
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" onpagechanging="AspNetPager1_PageChanging">
</webdiyer:AspNetPager>datalist的绑定代码如下:
protected void dlDataBind(string id)
{
...
int count = comment.GetCommentCount(id);//总页数 DataSet ds = comment.GetCommentbyId(id);//数据源
DataView dv = ds.Tables[0].DefaultView;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dv;
pds.AllowPaging = true;
this.dlComment.DataSource = ds;
this.dlComment.DataBind(); AspNetPager pager = (AspNetPager)this.dlComment.FindControl("AspNetPager1");//分页控件,此处出错
pager.PageSize = 3;
pager.RecordCount = count;
pds.CurrentPageIndex = pager.CurrentPageIndex - 1;
pds.PageSize = pager.PageSize;
}
解决方案 »
- CS里怎么写Label textbox button及button的事件
- 如何从电脑里取图片在页面播放
- Url重定向问题
- 珠海2000+三餐 .net程序员,应届本科,是高是低?
- Request.QueryString对中文参数的问题
- 设计一个简单webform时遇到的错误信息
- 数据库设计问题update/insert
- GridView添加LinkButton更新数据库,遇到问题
- 请教两个问题:谢谢
- 怎样使一个Panel在页面上可用鼠标来回托动(可设一个标题栏)?(Drag Layer的效果)
- 请问把一个三层的桌面程序 改成ASP.net 有什么好方法没有? 谢谢大家了。是在麻烦
- ★小白:DataList分页控件使用出现的问题
private void Repeater_ItemDataBound(object sender,RepeaterItemEventArgs e)
{
RepeaterItem item = e.Item;
if(item.ItemType == ListItemType.Footer)
{
Label lbl=new Label();
lbl = () item.FindControl("Label1");
......
}
}
但是ItemDataBound方法是绑定数据后发生,
找到Label就是显示上一页,下一页的,发生在绑定数据中,这里找到了lablel,如何对它进行操作呢?