日期:2014-05-18  浏览次数:20483 次

gridview分页后显示不正常 偶尔只显示一行半 刷新也不管用
小弟初学,好不容易搞定了查询加分页,没想到不知道什么原因显示不正常了,郁闷,第一页显示都正常,在点击某一页后,偶尔显示的不正常,只显示一行半,下边的全是空白了,困惑....

各位大哥给看看   同时看看小弟写的哪里有不好的地方,回者有分,谢谢各位大哥!

        Protected   Sub   BtnSearch_Click(ByVal   sender   As   Object,   ByVal   e   As   System.EventArgs)   Handles   BtnSearch.Click

                Dim   BusConn   As   New   SqlConnection

                Dim   StrSearch   As   String

                If   Trim(TxtBus.Text)   =   " "   Then
                        StrSearch   =   "select   (LineNum+ '路 ')   as   LineNum,LineType,Path,BothTime,Corp,( '共 '+Stations+ '站 ')   as   Stations   from   BusLine   order   by   ShowNum "
                Else
                        Dim   StrWhere   As   String
                        Dim   StrBus()   As   String
                        Dim   I   As   Integer

                        StrBus   =   Split(TxtBus.Text,   "   ")

                        If   RadioLineNum.Checked   =   True   Then
                                StrWhere   =   "   where   linenum   in   ( '0 ' "
                                For   I   =   0   To   UBound(StrBus)
                                        StrWhere   =   StrWhere   &   ", ' "   &   StrBus(I)   &   " ' "
                                Next   I
                                StrWhere   =   StrWhere   &   ") "
                        Else
                                StrWhere   =   "   where   1=1   "
                                For   I   =   0   To   UBound(StrBus)
                                        StrWhere   =   StrWhere   &   "   and   path   like   '% "   &   StrBus(I)