您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)access數(shù)據(jù)庫中的分頁功能怎么利用asp.net實(shí)現(xiàn),文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。
具體實(shí)例代碼如下:
<divclass="page"id="ctrlRecordPage"> 總<asp:LabelID="Zpage"runat="server"Text="1"></asp:Label>頁/ <asp:LabelID="Zcount"runat="server"Text="0"></asp:Label>條 <asp:LinkButtonID="start_button"runat="server"onclick="start_button_Click">首頁</asp:LinkButton> <asp:LinkButtonID="up_button"runat="server"onclick="up_button_Click">上一頁</asp:LinkButton> <asp:LinkButtonID="down_button"runat="server"onclick="down_button_Click">下一頁</asp:LinkButton> <asp:LinkButton ID="end_button" runat="server" onclick="end_button_Click">末頁</asp:LinkButton> 每頁<asp:TextBoxID="Pagesize"runat="server"Text="10"Width="30px"></asp:TextBox>條 當(dāng)前<asp:DropDownListID="Pageing"runat="server"AutoPostBack="True" onselectedindexchanged="Pageing_SelectedIndexChanged"></asp:DropDownList>頁 </div> privatevoidPageing_databird(intvalue) { Pageing.Items.Clear(); intzdatapage=Convert.ToInt32(Zpage.Text); if(zdatapage>0) { for(inti=1;i<=zdatapage;i++) { Pageing.Items.Add(i.ToString()); } } else { Pageing.Items.Add("1"); } if(Pageing.Items.FindByValue(value.ToString())!=null)Pageing.SelectedValue=value.ToString(); if(zdatapage>1) { Pageing.Enabled=true; intdatapageing=Convert.ToInt32(Pageing.SelectedValue); if(datapageing>1) { start_button.Enabled=true; up_button.Enabled=true; } else { start_button.Enabled=false; up_button.Enabled=false; } if(datapageing<zdatapage) { down_button.Enabled=true; end_button.Enabled=true; } else { down_button.Enabled=false; end_button.Enabled=false; } } else { start_button.Enabled=false; up_button.Enabled=false; down_button.Enabled=false; end_button.Enabled=false; Pageing.Enabled=false; } } protectedvoidstart_button_Click(objectsender,EventArgse) { intdatapageing=1; if(Pageing.Items.FindByValue(datapageing.ToString())!=null)Pageing.SelectedValue=datapageing.ToString(); DataBird(); } protectedvoidup_button_Click(objectsender,EventArgse) { intdatapageing=Convert.ToInt32(Pageing.SelectedValue); if(datapageing>1)datapageing--; if(Pageing.Items.FindByValue(datapageing.ToString())!=null)Pageing.SelectedValue=datapageing.ToString(); DataBird(); } protectedvoiddown_button_Click(objectsender,EventArgse) { intdatapageing=Convert.ToInt32(Pageing.SelectedValue); intzdatapage=Convert.ToInt32(Zpage.Text); if(datapageing<zdatapage)datapageing++; if(Pageing.Items.FindByValue(datapageing.ToString())!=null)Pageing.SelectedValue=datapageing.ToString(); DataBird(); } protectedvoidend_button_Click(objectsender,EventArgse) { intzdatapage=Convert.ToInt32(Zpage.Text); if(Pageing.Items.FindByValue(zdatapage.ToString())!=null)Pageing.SelectedValue=zdatapage.ToString(); DataBird(); } protectedvoidPageing_SelectedIndexChanged(objectsender,EventArgse) { DataBird(); } protectedvoidDataBird() { dc.Setsql="select*fromadlistorderbycreatetimedesc"; DataTabledt=dc.GetDataTable(0); PagedDataSourcepds=newPagedDataSource(); pds.DataSource=dt.DefaultView; pds.AllowPaging=true; intdatapagesize=10; if(Convert.ToInt32(Pagesize.Text)>0)datapagesize=Convert.ToInt32(Pagesize.Text); pds.PageSize=datapagesize; Zcount.Text=pds.DataSourceCount.ToString(); Zpage.Text = pds.PageCount.ToString(); intzpaging=1; if(Pageing.SelectedIndex>-1)zpaging=Convert.ToInt32(Pageing.SelectedValue); Pageing_databird(zpaging); pds.CurrentPageIndex=Convert.ToInt32(Pageing.SelectedValue)-1; listshow_Repeater.DataSource=pds; listshow_Repeater.DataBind(); }
關(guān)于access數(shù)據(jù)庫中的分頁功能怎么利用asp.net實(shí)現(xiàn)就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。