發(fā)文章
發(fā)文工具
撰寫
網(wǎng)文摘手
文檔
視頻
思維導(dǎo)圖
隨筆
相冊(cè)
原創(chuàng)同步助手
其他工具
圖片轉(zhuǎn)文字
文件清理
AI助手
留言交流
前臺(tái)頁面 A.aspx:
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Repeater ID="rptList" runat="server">
<ItemTemplate>
<div class="saleexpo_div" onmouseover="this.style.backgroundColor='#FFFFEF'" onmouseout="this.style.backgroundColor=''">
<div class="saleexpo_div1">
<a href="ConventionDetailsApply.aspx?ConList=<%#Eval("ExhibitionID")%>" target="_blank">
<img id="Img1" alt="" src='<%# myUtilitiesCS.ChkImageExist(0,"images/Exhibition/"+ DataBinder.Eval(Container.DataItem,"ImageUrl"),"images/NoPhoto_Exh.jpg")%>'
runat="server">
</a>
</div>
<div class="saleexpo_div2">
<h2>
<a href='ConventionDetailsApply.aspx?ConList=<%#Eval("ExhibitionID")%>' target="_blank">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("TitleValue") %>'></asp:Label>
</h2>
<p>
<span>展會(huì)時(shí)間:</span><%# DateTime.Parse(Eval("StartDT").ToString()).ToShortDateString()+" 至 "+DateTime.Parse(Eval("EndDT").ToString()).ToShortDateString() %>
</p>
<span>展會(huì)地址:</span><%#Eval("CountryName").ToString()+Eval("AreaName").ToString()%>
<span>展會(huì)簡介:</span>
<%#Eval("ContentValue") %>
<div class="saleexpo_divl">
</ItemTemplate>
</asp:Repeater>
=============================
后臺(tái)代碼 A.aspx.cs:
public partial class ConventionList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
BindToDataList();
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
private void BindToDataList()
int pageIndex = this.AspNetPager1.CurrentPageIndex - 1;
int pageSize = 5;
this.AspNetPager1.PageSize = pageSize;
int firstPage = pageIndex * pageSize;
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
string sql = "select M.ExhibitionID,M.SystemID,M.TitleValue,M.ContentValue,M.ScopeValue,M.OrganizerValue,Country.CountryName,Area.AreaName,E.ExhibitionID,E.HttpUrl,E.StartDT,E.EndDT,E.ImageUrl from Country left join Area on Country.CountryID=Area.CountryID left join Pavilion on Area.AreaID=Pavilion.AreaID left join Exhibition E on E.PavilionID=Pavilion.PavilionID left join MultiLangExpo M on M.ExhibitionID=E.ExhibitionID where M.SystemID=1 and E.TypeID=1 and E.deleted=0 and StartDT > getDate() order by StartDT Desc";
SqlDataAdapter da = new SqlDataAdapter(sql,conn);
DataSet ds = new DataSet();
da.Fill(ds, firstPage, pageSize, "listall");
DataTable dt = ds.Tables["listall"];
AspNetPager1.RecordCount = getCount();
rptList.DataSource = dt;
rptList.DataBind();
private int getCount()
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
string sql = "";
sql = "select Count(E.ExhibitionID) from Country left join Area on Country.CountryID=Area.CountryID left join Pavilion on Area.AreaID=Pavilion.AreaID left join Exhibition E on E.PavilionID=Pavilion.PavilionID left join MultiLangExpo M on M.ExhibitionID=E.ExhibitionID where M.SystemID=1 and E.TypeID=1 and E.deleted=0 and StartDT > getDate()";
SqlCommand com = new SqlCommand(sql, con);
con.Open();
int temp = Convert.ToInt32(com.ExecuteScalar());
con.Close();
return temp;
來自: 昵稱10504424 > 《工作》
0條評(píng)論
發(fā)表
請(qǐng)遵守用戶 評(píng)論公約
簡單的ASP.NET無刷新分頁
CREATE procedure [dbo].[P_Pager] (@PageNumber int, @PageSize int) as declare @sql nvarchar(4000) set @sql = ''select top '' + Convert(varchar, @PageSize) + '...
AspNetPager分頁控件
AspNetPager分頁控件AspNetPager分頁控件解決了分頁中的很多問題,直接采用該控件進(jìn)行分頁處理,會(huì)將繁瑣的分頁工作變得簡單化,下面是我如何使用AspNetPager控件進(jìn)行分頁處理的詳細(xì)代碼:1.首先到www....
ASP.NET 2.0 中AspNetPager.dll控件的分頁方法操作方法
ASP.NET 2.0 中AspNetPager.dll控件的分頁方法操作方法大家好,我是Asp.net的忠實(shí)愛好者, 今天做項(xiàng)目時(shí)學(xué)會(huì)一種新控件[AspNetPager.dll]用法,很想把這方面的經(jīng)驗(yàn)和大家分享一下,歡迎大家一起進(jìn)來討論討...
ASPNETPAGER分頁控件的使用方法[圖文]
ASPNETPAGER分頁控件的使用方法[圖文]ASPNETPAGER分頁控件的使用方法, 比較基礎(chǔ)。復(fù)制代碼 代碼如下: <div style="text-align:...
Asp.Net數(shù)據(jù)控件引用AspNetPager.dll分頁實(shí)現(xiàn)代碼
Net數(shù)據(jù)控件引用AspNetPager.dll分頁實(shí)現(xiàn)代碼。下面開講: 第一步:首先是下載一個(gè)AspNetPager.dll 下載地址 AspNetPager.rar第二步:在項(xiàng)目的bin文件夾下引用AspNetPager.dll 如圖:第三步:在工具箱...
分頁
//動(dòng)態(tài)設(shè)置用戶自定義文本內(nèi)容 AspNetPager1.CustomInfoText="記錄總數(shù):<font color=\"blue\"><b>"+AspNetPager1.RecordCount.ToString()+"</b></font...
使用aspnetpager,設(shè)定默認(rèn)CurrentPageIndex的方法
使用aspnetpager,設(shè)定默認(rèn)CurrentPageIndex的方法。只要把頁數(shù)AspNetPager1.CurrentPageIndex保存在session里面 在加載的時(shí)候如果session中有值的話就把session中的值設(shè)置給AspNetPager1.CurrentPageI...
ASP.NET 數(shù)據(jù)列表控件的分頁總結(jié)(三):Asp.Net 可定制分頁用戶控件
ASP.NET 數(shù)據(jù)列表控件的分頁總結(jié)(三):Asp.Net 可定制分頁用戶控件。AspNetPager除提供默認(rèn)的類似于DataGrid和GridView的PostBack分頁方式外,還支持通過Url進(jìn)行分頁,象大多數(shù)asp程序中分頁一樣, U...
分頁SQLServer存儲(chǔ)過程
/// </summary> /// <param name="userid">數(shù)據(jù)庫FavList的字段,用戶ID</param> /// <param name="strwhere">查找的條件</param>...
微信掃碼,在手機(jī)上查看選中內(nèi)容