Public PageNo As New DropDownList
Protected Sub gviewemployees_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
Dim bottonPagerRow As GridViewRow = gviewemployees.BottomPagerRow
Dim bottonPagerNo As New Label()
bottonPagerNo.Text = "目前所在分页码(" & (gviewemployees.PageIndex + 1) & "/" & gviewemployees.PageCount.ToString() & ")"
bottonPagerRow.Cells(0).Controls.Add(bottonPagerNo)
Dim myLiteral As New Literal()
myLiteral.Text = "<BR/>"
bottonPagerRow.Cells(0).Controls.Add(myLiteral)
'动态下拉框分页
Dim I As Integer
Dim PageNo As New DropDownList
PageNo.ID = "pageno"
PageNo.AutoPostBack = True
PageNo.Items.Clear()
For I = 0 To gviewemployees.PageCount - 1
PageNo.Items.Add(I + 1)
Next
PageNo.SelectedItem.Text = Me.gviewemployees.PageIndex + 1
AddHandler PageNo.TextChanged, AddressOf PageNo_TextChanged
bottonPagerRow.Cells(0).Controls.Add(PageNo)
End Sub
Protected Sub PageNo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Me.gviewemployees.PageIndex = Val(PageNo.SelectedItem.Text) - 1
gviewemployees_DataBound(sender, e)
End Sub
为什么在改变下拉框的内容时, gridview控件的BottomPagerRow中的下拉框不见了??