为何要点击两下才有反应?
Dim db_do As New DoDb
Dim dt As New Data.DataTable
Dim ds As New Data.DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dt = db_do.db_select( "Select * From DataT ")
ds.Tables.Add(dt)
G1.DataSource = ds.Tables(0)
G1.DataBind()
dt.Dispose()
End Sub
Protected Sub G1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles G1.PageIndexChanging
Response.Write(e.NewPageIndex)
G1.PageIndex = e.NewPageIndex
End Sub
G1是gridview 设置了自动分页功能,现在的数据分成2页。问题是点击页数1或者2的时候需要点两次才能看到页码相对应的数据。为何?
谢谢!
------解决方案--------------------好像 G1.PageIndex = e.NewPageIndex
完了以后没有绑定吧?