The use of Ajax methods to achieve paging is also very simple, mainly two, contenttemplate and trigger. Throw the ListView into the ContentTemplate first. Then add Asp:asyncpostbacktrigger to the trigger and point the ID to the previous paging control DataPager control. Specific implementation of the code can be referred to this article
The ListView list is very easy to implement for paging. The ListView paging is very simple, plus a DataPager control that assigns the ListView ID to it. That's what I wrote at the beginning. (Online people say this is pseudo-paging?) )
<asp:listview id= "Newblogitems" runat= "Server" datasourceid= "AccessDataSource1" viewstatemode= "Disabled" > <ItemTemplate> <li class= "Newblogitem" > ... .. </li> </ItemTemplate> </asp:listview><asp:datapager id= "DataPager1" runat= "Server" Pagesize= "pagedcontrolid=" Newblogitems "viewstatemode=" Disabled "> <Fields> <asp: Nextpreviouspagerfield buttontype= "Link" showfirstpagebutton= "True" shownextpagebutton= "False" showpreviouspagebutton= "False"/> <asp:numericpagerfield/> <asp:nextpreviouspagerfield Buttontype= "Link" showlastpagebutton= "True" shownextpagebutton= "false" showpreviouspagebutton= "false"/> </Fields></asp:DataPager>
However, to finish this, click on the effect of paging is to refresh the entire page, refresh the page to jump to jump off of course is not friendly, so to update the page, the first thought of the jquery plug-in, so in the online download jpages this plug-in, fiddling with a half-day did not make, also do not know where there are errors ... So abandoned the pit, or Ajax it!
Using the Ajax method, it is easy to pull the elephant into the refrigerator for a total of three steps.
1. Introduce the AJAX control ScriptManager and put it in the form.
2. Introduce the AJAX control UpdatePanel.
3. Edit the UpdatePanel content.
The main is two, ContentTemplate and trigger. Throw the ListView into the ContentTemplate first. Then add Asp:asyncpostbacktrigger to the trigger and point the ID to the previous paging control DataPager control, so that's it. The code is as follows:
<asp:updatepanel runat= "Server" > <ContentTemplate> <%--Data source--%><asp:accessdatasource id= " AccessDataSource1 "runat=" Server "datafile=" C:\storage\users.accdb "selectcommand=" SELECT [UserName], [Blogtitle], [ Blogtime], [Blogurl],[statis] from [blog] ORDER by [Blogtime] DESC "></asp:accessdatasource><asp:listview Id= "Newblogitems" runat= "Server" datasourceid= "AccessDataSource1" viewstatemode= "Disabled" > <itemtemplate > <li class= "Newblogitem" > 1000 words omitted here </li> </itemtemplate></asp:listview><asp :D atapager id= "DataPager1" runat= "Server" pagesize= "pagedcontrolid=", Newblogitems "viewstatemode=" > <Fields> <asp:nextpreviouspagerfield buttontype= "Link" showfirstpagebutton= "True" shownextpagebutton= " False "showpreviouspagebutton=" false "/> <asp:numericpagerfield/> <asp:nextpreviouspagerfield ButtonT Ype= "Link" showlastpagebutton= "True" shownextpagebutton= "False" Showpreviouspagebutton= "False"/> </Fields> </asp:DataPager></ContentTemplate> <Triggers> & Lt;asp:asyncpostbacktrigger controlid= "DataPager1"/> </Triggers> </asp:UpdatePanel>