【发布时间】:2011-02-11 10:11:09
【问题描述】:
我正在尝试在我的 gridview 控件中实现分页。这是databind和pageindexchanged的代码
Private Sub BindGrid()
Dim dataTable as DataTable = CType(Session.Item(APPLICATION_DATA), DataTable)
Grid.DataSource = dataTable.DefaultView
Grid.DataBind()
End Sub
Protected Sub OnChangePageSize(ByVal send As Object, ByVal e As GridViewPageEventArgs) Handles Grid.PageIndexChanging
Grid.PageIndex = e.NewPageIndex
_BindGrid()
End Sub
但是在 Grid.DataBind() as 之后出现错误
"Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.GridViewPageEventArgs'"
为什么会出现这个错误?有什么帮助吗?
【问题讨论】:
标签: asp.net vb.net gridview pagination