ASP. NET uses ajax to implement partial page refreshing and ajax page Functions
It is very easy to implement pagination in the listview list. The pagination of ListView is very simple. Add a DataPager control and grant the ListView ID. This is what I wrote at the beginning. (Some people say this is a pseudo-Paging on the Internet ?)
<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="15" 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, after this writing, the effect of clicking the page is to refresh the entire page. After refreshing, the page is not friendly. Therefore, to partially update the page, I first thought of the jquery plug-in, so I downloaded the JPAGES plug-in on the Internet, and it was not completed after a long time. I don't know where the error was... So let's get rid of it. ajax is the best choice !.
The ajax method is easy to pull. There are three steps to install an elephant in the refrigerator.
1. Introduce the ajax control scriptManager and place it in form.
2. Introduce the ajax control UpdatePanel.
3. Edit the UpdatePanel content.
There are two main types: ContentTemplate and Trigger. First, throw the listView into the ContentTemplate. Add asp: AsyncPostBackTrigger to the Trigger and point the ID to the DataPager control of the previous paging control. The Code is as follows:
<Asp: UpdatePanel runat = "server"> <ContentTemplate> <% -- data source -- %> <asp: AccessDataSource ID = "accessperformance1" 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" performanceid = "accessperformance1" ViewStateMode = "Disabled"> <ItemTemplate> <li class = "newBlogItem"> 1000 words are omitted here </li> </ItemTemplate> </asp: listView> <asp: DataPager ID = "DataPager1" runat = "server" PageSize = "15" 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> </ContentTemplate> <Triggers> <asp: AsyncPostBackTrigger ControlID = "DataPager1"/> </Triggers> </asp: UpdatePanel>
The above is a small series of ASP. NET Using ajax to implement partial page refresh page function, hope to help everyone, if you have any questions, please leave a message, xiaobian will reply to you in a timely manner. Thank you very much for your support for the help House website!