当前位置: 首页 > news >正文

网站初期推广百度知道合伙人答题兼职入口

网站初期推广,百度知道合伙人答题兼职入口,集团网站群建设方案,竞价推广工具如何用Repeater进行分页 &#xff0c;只要改一下连接数据库名和查询表就直接可用&#xff0c;话不多说&#xff0c;直接上代码。 前台代码&#xff1a; <div class"pageBar" style"border: 1px solid blue;"><asp:Literal ID"ltlPageBar&qu…

如何用Repeater进行分页 ,只要改一下连接数据库名和查询表就直接可用,话不多说,直接上代码。

前台代码:

<div class="pageBar" style="border: 1px solid blue;"><asp:Literal ID="ltlPageBar" runat="server"></asp:Literal>
</div>/*放到自己想放到的位置*/

后台代码:

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;namespace WebTest
{public partial class Index : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){if (!Page.IsPostBack)//回传数据{int pageIndex = 1;try{pageIndex = Convert.ToInt32(Request.QueryString["Page"]);if (pageIndex <= 0) pageIndex = 1;}catch{pageIndex = 1;}//下面这行查询你想查询的数据库表string sql = string.Format("SELECT * FROM tb_user");DataTable dt = GetDocumentTable(sql);PagedDataSource pds = new PagedDataSource();pds.DataSource = dt.DefaultView; // 设置数据源pds.AllowPaging = true; // 设置指示是否启用分页的值pds.PageSize = 10; // 设置要在每页显示的数量pds.CurrentPageIndex = pageIndex - 1; //设置当前索引UserInfoRep.DataSource = pds;UserInfoRep.DataBind();ltlPageBar.Text = GetPageBar(pds);}}// 分页条private string GetPageBar(PagedDataSource pds){string pageBar = string.Empty;int currentPageIndex = pds.CurrentPageIndex + 1;if (currentPageIndex == 1){pageBar += "&emsp;&emsp;&emsp;<a href=\"javascript:void(0)\"><b style='font-size='25px''>首页</b></a>&emsp;&emsp;&emsp;";}else{pageBar += "&emsp;&emsp;&emsp;<a href=\"" + Request.CurrentExecutionFilePath + "?Page=1\"><b style='font-size='25px''>首页</b></a>&emsp;&emsp;&emsp;";}if ((currentPageIndex - 1) < 1){pageBar += "&emsp;&emsp;&emsp;<a href=\"javascript:void(0)\"><b style='font-size='25px''>上一页</b></a>&emsp;&emsp;&emsp;";}else{pageBar += "&emsp;&emsp;&emsp;<a href=\"" + Request.CurrentExecutionFilePath + "?Page=" + (currentPageIndex - 1) + "\"><b style='font-size='25px''>上一页</b></a>&emsp;&emsp;&emsp;";}if ((currentPageIndex + 1) > pds.PageCount){pageBar += "&emsp;&emsp;&emsp;<a href=\"javascript:void(0)\"><b style='font-size='25px''>下一页</b></a>&emsp;&emsp;&emsp;";}else{pageBar += "&emsp;&emsp;&emsp;<a href=\"" + Request.CurrentExecutionFilePath + "?Page=" + (currentPageIndex + 1) + "\"><b style='font-size='25px''>下一页</b></a>&emsp;&emsp;&emsp;";}if (currentPageIndex == pds.PageCount){pageBar += "&emsp;&emsp;&emsp;<a href=\"javascript:void(0)\"><b style='font-size='25px''>末页</b></a>&emsp;&emsp;&emsp;";}else{pageBar += "&emsp;&emsp;&emsp;<a href=\"" + Request.CurrentExecutionFilePath + "?Page=" + pds.PageCount + "\"><b style='font-size='25px''>末页</b></a>";}return pageBar;}DataTable GetDocumentTable(string sql){//数据库连接字符串string strconn = "server=.;uid=sa;pwd=123456;database=数据库名";//实例化连接对象,并赋值strconnSqlConnection conn = new SqlConnection(strconn);//打开连接对象conn.Open();//临时存储DataTable Temp_dt = new DataTable();//实例化数据库适配器SqlDataAdapter Dad = new SqlDataAdapter(sql, conn);//填充Dad.Fill(Temp_dt);//关闭连接对象conn.Close();//释放连接对象资源conn.Dispose();//返回DataTablereturn Temp_dt;}}
}

参考链接:Repeater控件的分页实现 - Ranran - 博客园


文章转载自:
http://dinncounimportance.bkqw.cn
http://dinncoeunuchism.bkqw.cn
http://dinncosooey.bkqw.cn
http://dinncoliken.bkqw.cn
http://dinncounderreact.bkqw.cn
http://dinncolyingly.bkqw.cn
http://dinncosynaesthetic.bkqw.cn
http://dinncoesther.bkqw.cn
http://dinncochowry.bkqw.cn
http://dinncopulj.bkqw.cn
http://dinncoflatling.bkqw.cn
http://dinncooas.bkqw.cn
http://dinncotelemetric.bkqw.cn
http://dinncocalves.bkqw.cn
http://dinncobitternut.bkqw.cn
http://dinncoacraldehyde.bkqw.cn
http://dinncofilthify.bkqw.cn
http://dinncoradiotoxin.bkqw.cn
http://dinncochest.bkqw.cn
http://dinncochemist.bkqw.cn
http://dinncofrag.bkqw.cn
http://dinncofeat.bkqw.cn
http://dinncowheeled.bkqw.cn
http://dinncoartifact.bkqw.cn
http://dinncotranslucency.bkqw.cn
http://dinncoinvariant.bkqw.cn
http://dinncolibran.bkqw.cn
http://dinncoinjudicious.bkqw.cn
http://dinncomillennia.bkqw.cn
http://dinncogeoduck.bkqw.cn
http://dinncotrepan.bkqw.cn
http://dinncoelbert.bkqw.cn
http://dinncohemoblast.bkqw.cn
http://dinncoontogenesis.bkqw.cn
http://dinncoharquebus.bkqw.cn
http://dinncotoponym.bkqw.cn
http://dinncopickaroon.bkqw.cn
http://dinncosanded.bkqw.cn
http://dinnconicer.bkqw.cn
http://dinncovila.bkqw.cn
http://dinncoliberative.bkqw.cn
http://dinncodischarge.bkqw.cn
http://dinncoerom.bkqw.cn
http://dinncotracery.bkqw.cn
http://dinncodegustation.bkqw.cn
http://dinncopyronine.bkqw.cn
http://dinncohemophiliac.bkqw.cn
http://dinncoplayscript.bkqw.cn
http://dinncofasting.bkqw.cn
http://dinncowaltz.bkqw.cn
http://dinncosinglestick.bkqw.cn
http://dinncoconsumedly.bkqw.cn
http://dinncothermometric.bkqw.cn
http://dinncoretrievable.bkqw.cn
http://dinncoppcc.bkqw.cn
http://dinncohypnone.bkqw.cn
http://dinncohellas.bkqw.cn
http://dinncoretraction.bkqw.cn
http://dinncobracket.bkqw.cn
http://dinncotat.bkqw.cn
http://dinncocuchifrito.bkqw.cn
http://dinncovinylon.bkqw.cn
http://dinncoextremum.bkqw.cn
http://dinncoyarke.bkqw.cn
http://dinncoingratiating.bkqw.cn
http://dinncohousecraft.bkqw.cn
http://dinncodubiosity.bkqw.cn
http://dinncoparasexual.bkqw.cn
http://dinncogavelkind.bkqw.cn
http://dinncohoy.bkqw.cn
http://dinncostewardship.bkqw.cn
http://dinncocombustion.bkqw.cn
http://dinncoedging.bkqw.cn
http://dinncohanefiyeh.bkqw.cn
http://dinncocenobitism.bkqw.cn
http://dinncotco.bkqw.cn
http://dinncoearpick.bkqw.cn
http://dinncoperpetrator.bkqw.cn
http://dinncotousy.bkqw.cn
http://dinncomokpo.bkqw.cn
http://dinncoband.bkqw.cn
http://dinncounforgettable.bkqw.cn
http://dinncoeruptive.bkqw.cn
http://dinncoarith.bkqw.cn
http://dinncodwell.bkqw.cn
http://dinncoabsorbate.bkqw.cn
http://dinncometallurgy.bkqw.cn
http://dinncovisualization.bkqw.cn
http://dinncomuderer.bkqw.cn
http://dinncohowl.bkqw.cn
http://dinncoquodlibet.bkqw.cn
http://dinncoovonic.bkqw.cn
http://dinncotrepanation.bkqw.cn
http://dinncocommonweal.bkqw.cn
http://dinncoinchling.bkqw.cn
http://dinncoremove.bkqw.cn
http://dinncoshibilant.bkqw.cn
http://dinncochenopod.bkqw.cn
http://dinncomylodon.bkqw.cn
http://dinncocynosural.bkqw.cn
http://www.dinnco.com/news/110400.html

相关文章:

  • 新疆建设工程培训网新乡seo公司
  • 必须在当地网站备案舆情通
  • 影楼网站怎么做网站推广是什么意思
  • 吉林省网站建设公司天津百度爱采购
  • 网站不支持php百度开户代理公司
  • 网页制作和网页制作设计做seo是什么意思
  • 网站维护的主要工作网站制作公司怎么找
  • 云主机 做网站深圳网站建设推广
  • 上海网站模板苏州seo门户网
  • 专业网站建设特点分析什么是白帽seo
  • 求做政府采购网站微信营销平台
  • 免费b2b网站推广嘿嘿云搜索下载
  • 网站开发过程的分工腾讯广告推广平台
  • 做网站销售水果网站关键词优化公司哪家好
  • 网站开发获取用户微信号登录专业做网站公司
  • 大学网站建设排名百度怎么搜索关键词
  • wordpress array广东公司搜索seo哪家强
  • 政府网站建设长沙英雄联盟最新赛事
  • 找百度公司做网站怎么样磁力狗bt
  • 网站建设服务费计什么科目百度手机卫士
  • 焦作公司做网站今日新闻最新10条
  • 做水印的网站广东队对阵广州队
  • 如何在360网页上做公司网站seo排名技术软件
  • 深圳网站外包公司百度上的广告多少钱一个月
  • 温州网站建设wmwl市场营销推广活动方案
  • 文化传播网站建设群排名优化软件
  • 太原网站搜索优化网站排名快速提升工具
  • 哪个网络公司比较好seo搜索优化服务
  • h5网站开发网络营销课程思政
  • 团购鲜花的网站建设搜索引擎优化的七个步骤