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:listviewID= "Newblogitems"runat= "Server"DataSourceID= "AccessDataSource1"ViewStateMode= "Disabled"> <ItemTemplate> <Liclass= "Newblogitem"> ..... </Li> </ItemTemplate> </Asp:listview><Asp:datapagerID= "DataPager1"runat= "Server"PageSize= " the"Pagedcontrolid= "Newblogitems"ViewStateMode= "Disabled"> < Fields> <Asp:nextpreviouspagerfieldButtonType= "Link"Showfirstpagebutton= "True"Shownextpagebutton= "False"Showpreviouspagebutton= "False" /> <Asp:numericpagerfield/> <Asp:nextpreviouspagerfieldButtonType= "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:updatepanelrunat= "Server"> <ContentTemplate> <%--Data Source--%><Asp:accessdatasourceID= "AccessDataSource1"runat= "Server"datafile= "C:\STORAGE\USERS.ACCDB"SelectCommand= "SELECT [UserName], [Blogtitle], [Blogtime], [Blogurl],[statis] from [blog] ORDER by [Blogtime] DESC"></Asp:accessdatasource><Asp:listviewID= "Newblogitems"runat= "Server"DataSourceID= "AccessDataSource1"ViewStateMode= "Disabled"> <ItemTemplate> <Liclass= "Newblogitem">1000 words omitted here</Li> </ItemTemplate></Asp:listview><Asp:datapagerID= "DataPager1"runat= "Server"PageSize= " the"Pagedcontrolid= "Newblogitems"ViewStateMode= "Disabled"> < Fields> <Asp:nextpreviouspagerfieldButtonType= "Link"Showfirstpagebutton= "True"Shownextpagebutton= "False"Showpreviouspagebutton= "False" /> <Asp:numericpagerfield/> <Asp:nextpreviouspagerfieldButtonType= "Link"Showlastpagebutton= "True"Shownextpagebutton= "False"Showpreviouspagebutton= "False" /> </ Fields> </Asp:datapager></ContentTemplate> <Triggers> <Asp:asyncpostbacktriggerControlID= "DataPager1"/> </Triggers> </Asp:updatepanel>
See more code content, welcome to my Independent blog! My blog for this article URL. Home: www.songshizhao.com
Asp. NET partial page Refresh page with Ajax implementation