本文介绍了更改页面时Gridview消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 当我改变页面时,我的gridview消失了 受保护 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 pageProtected Sub GridPrevistos_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs) Handles GridPrevistos.PageIndexChanging GridPrevistos.PageIndex = e.NewPageIndex GridPrevistos.DataBind() End Subpls remind that um using vb.net and asp.netty 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 linesGridPrevistos.PageIndex = e.NewPageIndexGridPrevistos.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消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-12 15:52