日期:2014-05-17 浏览次数:20605 次
<div class="lst_box" id="divNewsList" runat="server"><!--文章列表--></div> <div class="page"><a href="/NewsList_1.html">第一页</a><span class="NewsList_2.html">2</span><a href="NewsList_3.html">3</a>/div>
void bindData(string strSortID,string strNewsTitle) { if (ViewState["Sort"] == null) ViewState["Sort"] = "AddDate DESC"; int TotalPage = 0; int TotalRecord = 0; int PageSize = 12; int CurrentPage = 1; //#region 循环分类 DataTable dtBizClass = FrontPageBiz.GetPageNewsListByConditions(1,NewsSortID,SearchKeyWord, PageSize, ref CurrentPage, out TotalPage, out TotalRecord, (string)ViewState["Sort"]); for (int i = 1; i < dtBizClass.Rows.Count; i++) { divNewsList.Controls.Add(new LiteralControl("<div class=\"lstbox_m\"><h3><a href=\"/html/" + dtBizClass.Rows[i]["NewsID"].ToString() + ".html\">" + dtBizClass.Rows[i]["NewsTitle"].ToString() + "</a></h3><p class=\"more_big\">日期:" + string.Format("{0:d}", dtBizClass.Rows[i]["AddDate"]) + " 关注:100 <a href=\"#\">咨询专家</a></p> <p class=\"txt\">" + dtBizClass.Rows[i]["Descriptions"].ToString() + "</p></div>")); }
ALTER PROCEDURE [dbo].[XMLPageNewsListByCondition] ( @vType int, @SortID varchar(12), @NewsTitle varchar(120), @PageSize int, @CurrentPage int output, @TotalPage int output, @TotalRecord int output, @SortBy varchar(100) ) AS
//-----分页所使用的变量 private int num = 148; //在页面显示几条信息 private int pageSize = 5; protected void Page_Load(object sender, EventArgs e) { //首次加载 if (!IsPostBack) { DlBooksPage(); } } /// <summary> /// 分页 /// </summary> /// <param name="CurrentPage"></param> private void DataListBind(int CurrentPage) { int pageCount = this.BookNum(); if (CurrentPage < 1) { CurrentPage = 1; } if (CurrentPage > pageCount) { CurrentPage = pageCount; } if (CurrentPage == 1) { this.btnPre.Enabled = false; } if (CurrentPage == pageCount) { this.btnNext.Enabled = false; } this.lblCurrentPage.Text = CurrentPage.ToString(); this.lblPageCount.Text = pageCount.ToString(); //DataSourceID 和 DataSource 不能并存,如果要 rptSearch.DataSource 起作用必须把 DataSourceID 赋为空 if (dlBooks.DataSourceID != null) { dlBooks.DataSourceID = null; } //调用方法 dlBooks.DataSource = BookManager.GetBooksByPageSize(this.GetKey(), pageSize, CurrentPage, this.Get