使用datagrid分页本来是很简单的时候,但是在dnn中却没有常规的错误提示,以至于一头雾水。当我给datagrid添加OnPageIndexChanged="dg_PageIndexChnaged"后,出现错误提示:模块不能加载,ID相同之类的。后台又在一个单独的项目中进行同样的操作。原来将Private Sub dg_PageIndexChnaged(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles grdArticles.PageIndexChanged
改为Protected Sub dg_PageIndexChnaged(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles grdArticles.PageIndexChanged
即可,真是失之毫厘,谬以千里。希望高人们不要见笑。
其实在datagrid中进行分页只需要两步即可
1、
Protected Sub dg_PageIndexChnaged(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs)
grdArticles.CurrentPageIndex = e.NewPageIndex
BindList()
End Sub
2、datagrid属性中加入OnPageIndexChanged="dg_PageIndexChnaged"