ASP.net中网格视图分页的问题 [英] Problem with pagination of Grid View in ASP.net
本文介绍了ASP.net中网格视图分页的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果数据源位于 Page_Load 事件中,我使用网格视图遇到问题。
但是当我手动使用GridView时 - >选择数据源在其属性中,我对分页没有任何问题。
我正在使用 Page_Load 事件,因为有一些参数。
请提前帮助和谢谢。我是ASP.net的新手。我还附上了我正在使用的代码。
============== ===========
Hi,
I'm having trouble with my pagination using grid view if the datasource is in Page_Load event.
But when I manually use the GridView -> choose datasource in its property, I don't have any problem with the pagination.
I'm using the Page_Load event because there are some parameters.
Please help and thanks in advance. I'm newbie in ASP.net. I've also attached the code I'm using.
=========================
Dim mycon As New SqlConnection("Data Source=xxx.168.14.xxx;Initial Catalog=mydatabase;User ID=myuser;Password=mypassword")
Dim myDataTable As New DataTable
Dim kcmd As New SqlClient.SqlCommand
Dim query As String
query = "select * from myquery "
mycon.Open()
kcmd.Connection = mycon
kcmd.CommandTimeout = 0
kcmd.CommandText = query
Dim kda As New SqlClient.SqlDataAdapter(kcmd)
Dim kdt As New DataTable
kda.Fill(kdt)
GridView1.DataSource = kdt
========= ================
=========================
推荐答案
如果设置了gridview的分页和页面大小属性,那么我不认为你在分页中遇到任何问题。
if you set the paging and page size property of gridview then I don't think u get any problem in pagination.
这篇关于ASP.net中网格视图分页的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文