【データ連結】【VS2005】EnablePaging プロパティをTrueに設定したObjectDataSourceと連結すると、ページナビゲーションボタンの表示が不正になる場合がある
対象製品
SPREAD for .NET 2.5J Web Forms Edition
発生環境
この現象は、Visual Studio 2005を使用した開発環境で発生します
状況
修正済み
詳細
SPREADがEnablePaging プロパティをTrueに設定したObjectDataSourceと連結すると、最終ページでのページナビゲーションボタンの表示が不正になる場合があります。
【手順】
1.新規WebフォームにSPREADとObjectDataSourceを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.ページナビゲーションボタン「2」を押下して2ページ目に移動します
4.ページナビゲーションボタン「>>」「>>|」が有効のまま(非活性にならない)です
【サンプルコード】
-------------------------
Webフォームクラス
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
ObjectDataSource1.TypeName = "Class1"
ObjectDataSource1.EnablePaging = True
ObjectDataSource1.SelectMethod = "SelectTestList"
ObjectDataSource1.SelectCountMethod = "SelectCount"
If IsPostBack Then
Return
End If
FpSpread1.Sheets(0).PageSize = 20
FpSpread1.Pager.Mode = FarPoint.Web.Spread.PagerMode.Both
FpSpread1.Pager.Position = FarPoint.Web.Spread.PagerPosition.Bottom
FpSpread1.Sheets(0).PageMaxAlign = False
FpSpread1.DataSourceID = ObjectDataSource1.ID
FpSpread1.DataBind()
End Sub
-------------------------
Class1
-------------------------
Public Class Class1
<DataObjectMethod(DataObjectMethodType.Select)> _
Public Function SelectTestList(ByVal startRowIndex As Integer, ByVal maximumRows As Integer) As DataTable
Dim dt As DataTable
dt = New DataTable("TBL_TEST")
dt.Columns.Add("TEST1")
dt.Columns.Add("ROWNO")
For i As Integer = startRowIndex To (startRowIndex + maximumRows) - 1
dt.Rows.Add(New Object() {"test", i})
Next i
Return dt
End Function
Public Function SelectCount() As Integer
Return 40
End Function
End Class
【手順】
1.新規WebフォームにSPREADとObjectDataSourceを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.ページナビゲーションボタン「2」を押下して2ページ目に移動します
4.ページナビゲーションボタン「>>」「>>|」が有効のまま(非活性にならない)です
【サンプルコード】
-------------------------
Webフォームクラス
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
ObjectDataSource1.TypeName = "Class1"
ObjectDataSource1.EnablePaging = True
ObjectDataSource1.SelectMethod = "SelectTestList"
ObjectDataSource1.SelectCountMethod = "SelectCount"
If IsPostBack Then
Return
End If
FpSpread1.Sheets(0).PageSize = 20
FpSpread1.Pager.Mode = FarPoint.Web.Spread.PagerMode.Both
FpSpread1.Pager.Position = FarPoint.Web.Spread.PagerPosition.Bottom
FpSpread1.Sheets(0).PageMaxAlign = False
FpSpread1.DataSourceID = ObjectDataSource1.ID
FpSpread1.DataBind()
End Sub
-------------------------
Class1
-------------------------
Public Class Class1
<DataObjectMethod(DataObjectMethodType.Select)> _
Public Function SelectTestList(ByVal startRowIndex As Integer, ByVal maximumRows As Integer) As DataTable
Dim dt As DataTable
dt = New DataTable("TBL_TEST")
dt.Columns.Add("TEST1")
dt.Columns.Add("ROWNO")
For i As Integer = startRowIndex To (startRowIndex + maximumRows) - 1
dt.Rows.Add(New Object() {"test", i})
Next i
Return dt
End Function
Public Function SelectCount() As Integer
Return 40
End Function
End Class
回避方法
2009/05/27版で修正済み。
キーワード
SPRN07214
この文書は、以前は次のバグレポートIDで公開されていました : 7847