0

DataList に DataPager を使用できますか?
実行しましたが、次の例外が発生しました!!!

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[InvalidOperationException: Control 'DataList1' does not implement IPageableItemContainer.]
   System.Web.UI.WebControls.DataPager.FindPageableItemContainer() +500609
   System.Web.UI.WebControls.DataPager.OnInit(EventArgs e) +33
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378
4

1 に答える 1

1

DataPager には、IPageableItemContainerインターフェイスを実装するためのページ コントロールが必要です。インターフェイスは 3.5 で導入されたため、古いコントロールはこのインターフェイスを実装していません。

回避策として、このインターフェイスを実装し、データ リストに使用するデータ ソースに基づいて必要なページング ロジックを提供するダミー コントロールを作成することができます。

EDIT:ところで、DataListの代わりにListViewコントロールをいつでも使用できます。

于 2010-08-31T10:11:26.123 に答える