不会吧。。哥private PagedDataSource pds()
{
string connstring = ConfigurationManager.ConnectionStrings["WHConn"].ConnectionString;
SqlConnection con = new SqlConnection(connstring); DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter("select * from gzhz order by 时间1 desc", con);
sda.Fill(ds, "gz");
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables["gz"].DefaultView;
pds.AllowPaging = true;
pds.PageSize = 15;
pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]);
return pds;
}
{
string connstring = ConfigurationManager.ConnectionStrings["WHConn"].ConnectionString;
SqlConnection con = new SqlConnection(connstring); DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter("select * from gzhz order by 时间1 desc", con);
sda.Fill(ds, "gz");
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables["gz"].DefaultView;
pds.AllowPaging = true;
pds.PageSize = 15;
pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]);
return pds;
}
{
foreach (RepeaterItem ite in Repeater1.Items)
{
------------------
这个写法肯定是不对的。但最后一行不受控制的原因现在 还看不出来,你可以断点调试一下
原来我相当于遍历了两次这个Repeater了,在把foreach循环去掉以后,稍加修改,就没问题了。
感谢阿非,不过,为什么遍历两次就会出现最后一行总是不受控的状态?不懂。