更改页面时Gridview消失 [英] Gridview dissapears when changing page

查看:88
本文介绍了更改页面时Gridview消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我改变页面时,我的gridview消失了



 受保护 < span class =code-keyword> Sub  GridPrevistos_PageIndexChanging( ByVal  sender  As  对象 ByVal  e  As  GridViewPageEventArgs)句柄 GridPrevistos.PageIndexChanging 
GridPrevistos.PageIndex = e.NewPageIndex
GridPrevistos.DataBind()
End Sub





请提醒你使用vb.net和asp.net

ty all:)

解决方案





请检查设计中的事件,我认为pageIndexChanging事件未被处理..



错误信息已明确说明..


在你的pageindexchanging事件中你写了以下几行

 GridPrevistos.PageIndex = e.NewPageIndex 
GridPrevistos.DataBind( )





但是在编写GridPreVistos.DataBind()时,你需要再次指定数据源(因为你可能有)首次绑定此网格时提供的。)



简单来说,在为gridview指定当前pageIndex之后,需要再次将其与dataSource绑定。这次它将在e.NewPageIndex中显示新页面的价值。





希望这对你有帮助。


my gridview dissapears when i change page

Protected Sub GridPrevistos_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs) Handles GridPrevistos.PageIndexChanging
        GridPrevistos.PageIndex = e.NewPageIndex
        GridPrevistos.DataBind()
    End Sub



pls remind that um using vb.net and asp.net
ty all :)

解决方案

Hi,

Please check the event in the design, i think the pageIndexChanging event is not handled..

The error message is clearly stated..


In your pageindexchanging event you wrote following lines

GridPrevistos.PageIndex = e.NewPageIndex
GridPrevistos.DataBind()



But when writing GridPreVistos.DataBind(), you need to specify the data source again (as you may have provided when you bound this grid for the first time).

in simple words, after you specified the current pageIndex for the gridview you need to bind it again with dataSource. This time it will show the new page as value in e.NewPageIndex.


Hope this will help you.


这篇关于更改页面时Gridview消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆