R
rhungund
Hey guys and gals, I have a paging problem. I have my datagrid paging
set to Top and Bottom. And for some reason, when I click next on the
bottom pager, it goes back to page one. If I set it to only bottom,
same problem. If i set it to top, it works fine. Any ideas?
here's the code:
<asp:datagrid id="dg" runat="server" EnableViewState="true"
OnSortCommand="dg_SortCommand" AllowSorting="True"
OnPageIndexChanged="dg_Page" PagerStyle-CssClass="body"
PagerStyle-PrevPageText="< Previous"
PagerStyle-NextPageText="Next >" PagerStyle-HorizontalAlign="left"
PagerStyle-Mode="NumericPages"
PagerStyle-Position=TopAndBottom PageSize="10" AllowPaging="True"
GridLines="Both" Width="960"
CellSpacing="2" CellPadding="2" BorderWidth="0">
<HeaderStyle CssClass="" ForeColor="#ffffff"
VerticalAlign="Top"></HeaderStyle>
<ItemStyle CssClass="body"></ItemStyle>
<Columns>
<asp:BoundColumn Visible="false"></asp:BoundColumn>
</Columns>
</asp:datagrid>
And code behind:
Sub dg_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
dg.CurrentPageIndex = e.NewPageIndex
dg.EditItemIndex = -1
If Session("srt") <> "" Then
myDataBind(Session("srt"), "")
Else
myDataBind("Study ID", "")
End If
End Sub
set to Top and Bottom. And for some reason, when I click next on the
bottom pager, it goes back to page one. If I set it to only bottom,
same problem. If i set it to top, it works fine. Any ideas?
here's the code:
<asp:datagrid id="dg" runat="server" EnableViewState="true"
OnSortCommand="dg_SortCommand" AllowSorting="True"
OnPageIndexChanged="dg_Page" PagerStyle-CssClass="body"
PagerStyle-PrevPageText="< Previous"
PagerStyle-NextPageText="Next >" PagerStyle-HorizontalAlign="left"
PagerStyle-Mode="NumericPages"
PagerStyle-Position=TopAndBottom PageSize="10" AllowPaging="True"
GridLines="Both" Width="960"
CellSpacing="2" CellPadding="2" BorderWidth="0">
<HeaderStyle CssClass="" ForeColor="#ffffff"
VerticalAlign="Top"></HeaderStyle>
<ItemStyle CssClass="body"></ItemStyle>
<Columns>
<asp:BoundColumn Visible="false"></asp:BoundColumn>
</Columns>
</asp:datagrid>
And code behind:
Sub dg_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
dg.CurrentPageIndex = e.NewPageIndex
dg.EditItemIndex = -1
If Session("srt") <> "" Then
myDataBind(Session("srt"), "")
Else
myDataBind("Study ID", "")
End If
End Sub