Проблема:
Когда я пытаюсь перейти на страницу 2 или любую другую последующую страницу сетки данных, она только обновляет страницу.
Markup:
<!--Main DataGrid-->
<asp:DataGrid
ID="dgTasks"
runat="server"
PageSize="40"
AllowPaging="true"
AutoGenerateColumns="false"
ForeColor="#333333"
GridLines="Both"
Font-Size="Small"
AllowSorting="true"
OnItemDataBound="Item_DataBound" >
<HeaderStyle
BackColor="#990000"
Font-Bold="True"
ForeColor="White"
HorizontalAlign="Center"
Font-Size="Small"/>
<Columns>
...
</Columns>
<SelectedItemStyle
BackColor="#FFCC66"
Font-Bold="True"
ForeColor="Navy" />
<PagerStyle
BackColor="#CCCCCC"
ForeColor="#333333"
HorizontalAlign="Right"
Mode="NumericPages" />
<AlternatingItemStyle
BackColor="White" />
<ItemStyle
BackColor="#FFFBD6"
ForeColor="#333333" />
<FooterStyle
BackColor="#990000"
Font-Bold="True"
ForeColor="White" />
</asp:DataGrid>
Код сзади:
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
'DoNothing'
Else
BindData("")
End If
End Sub
Private Sub BindData(ByVal strDisplayCompleted As String, ByVal strSort As String)
Dim taskDataSet As TaskDataSet = New TaskDataSet()
Dim dt As DataTable = taskDataSet.GetData("N").Tables(0)
For Each dr As DataRow In dt.Rows
If dr.Item(2).ToString().StartsWith("Vacancy") Then
dr.Delete()
End If
Next
If strSort.Length > 0 Then
dt.DefaultView.Sort = strSort
End If
dgTasks.DataSource = dt.DefaultView
dgTasks.DataBind()
End Sub
Private Sub BindData(ByVal strSort As String)
BindData("N", strSort)
End Sub
Теперь я даже не уверен, почему нумерация страниц не работает. У меня AllowPaging
равно true, я не связываю данные на PostBack, поэтому я в замешательстве. Любая помощь будет отличной. Спасибо.