|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with Top And Bottom Pagingset 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 Are you calling the myDataBind() Sub on every Page_Load or Page_Init?
I'm pretty sure this needs to happen. I'm having some problems with the pager on my datagrid at the moment too. But I've got my top and bottom pagers working the same way. I am binding on every page_init and in the pageindexchanged event. There are times when this is redundant, but the pageindexchanged event isn't always called. I'm not too sure of the technicalities of this, but I know that if I don't bind in the page_load or _init, my datagrid doesn't work right. Though it's not working right now, but the issue you're describing isn't happening with mine. HTH yep...calling myDataBind() everytime. just so weird because it works
for the top one, and not the bottom ones. here's what the javascript pager links are looking like though. top --> javascript:__doPostBack('dg$_ctl1$_ctl1','') bottom --> javascript:__doPostBack('dg$_ctl15$_ctl1','') well the linkbuttons themselves and the javascript for them is gen'd at
runtime by the framework, and you can't touch those anyway (as far as I know). Try playing the enableviewstate attribute of your datagrid. I removed my viewstate and had some things happen the way I wanted.
Hyperlink Format
DataGrid Export to Excel Can't get a reference to user control in datagrid Sorting Datagrid With Hyphen / Dash How can I format a telephone # in the datagrid email validation DataGrid sort when Editing Modify rows in DataTable Changing text to a textbox control in row 5 of a datagrid e.item.dataitem |
|||||||||||||||||||||||