PagedDataSourceを使って、SqlDataSourceをRepeaterにバインドする例
PagedDataSourceの存在を今日初めて知った。
確かRepeaterをページングするのは、結構面倒なコーディングが必要だと記憶していたけど、
コントロールが用意されていたとは知らなかった。
PagedDataSource pds = new PagedDataSource(); pds.DataSource = SqlDataSource1.Select(DataSourceSelectArguments.Empty); pds.AllowPaging = true; pds.PageSize = 10; pds.CurrentPageIndex = 0; Repeater1.DataSource = pds; Repeater1.DataBind(); //前へ進む・次へ進むボタンの非表示処理 if (pds.IsFirstPage) linkPrevious.Visible = false; if (pds.IsLastPage) linkNext.Visible = false;
まぁこんな感じで出来るみたい。GUIで出来ないんかなぁ。