网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

GridView中如何自定义分页-创新互联

GridView中如何自定义分页,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

成都创新互联坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站建设、做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的化州网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

CSS样式

首先把CSS样式代码粘贴过来:

.gv
{
  border: 1px solid #D7D7D7;
  font-size:12px;
  text-align:center;
}
.gvHeader
{
  color: #3F6293;
  background-color: #F7F7F7;
  height: 24px;
  line-height: 24px;
  text-align: center;
  font-weight: normal;
  font-variant: normal;
}
.gvHeader th
{
  font-weight: normal;
  font-variant: normal;
}
.gvRow, .gvAlternatingRow, .gvEditRow
{
  line-height: 20px;
  text-align: center;
  padding: 2px;
  height: 20px;
}
.gvAlternatingRow
{
  background-color: #F5FBFF;
}
.gvEditRow
{
  background-color: #FAF9DD;
}
.gvEditRow input
{
  background-color: #FFFFFF;
  width: 80px;
}
.gvEditRow .gvOrderId input, .gvEditRow .gvOrderId
{
  width: 30px;
}
.gvEditRow .checkBox input, .gvEditRow .checkBox
{
  width: auto;
}
.gvCommandField
{
  text-align: center;
  width: 130px;
}
.gvLeftField
{
  text-align: left;
  padding-left: 10px;
}
.gvBtAField
{
  text-align: center;
  width: 130px;
}
.gvCommandField input
{
  background-image: url(../Images/gvCommandFieldABg.jpg);
  background-repeat: no-repeat;
  line-height: 23px;
  border-top-style: none;
  border-right-style: none;
  border-bottom-style: none;
  border-left-style: none;
  width: 50px;
  height: 23px;
  margin-right: 3px;
  margin-left: 3px;
  text-indent: 10px;
}
.gvPage
{
  padding-left: 15px;
  font-size: 18px;
  color: #333333;
  font-family: Arial, Helvetica, sans-serif;
}
.gvPage a
{
  display: block;
  text-decoration: none;
  padding-top: 2px;
  padding-right: 5px;
  padding-bottom: 2px;
  padding-left: 5px;
  border: 1px solid #FFFFFF;
  float: left;
  font-size: 12px;
  font-weight: normal;
}
.gvPage a:hover
{
  display: block;
  text-decoration: none;
  border: 1px solid #CCCCCC;
}

GridView样式

根据上面列出的CSS样式样式名称,将他们分别加入网页GridView的不同标记中,举例如下:



Pager分页模板

其中gridview下方的换页代码为:


  
    
    
      第'>页
      /共'>页  
     ">首页
     ">上一页
     ">下一页
     ">尾页
     ' Width="20px" AutoPostBack="true" >
     
    
    
  

触发事件

方法btnGo_Click的定义如下所示:

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
  GridView1.PageIndex = e.NewPageIndex;
  BindData();
}
protected void btnGo_Click(object sender, EventArgs e)
{
  if (((LinkButton)sender).CommandArgument.ToString().ToLower().Equals("go"))
  {
    GridViewRow gridViewRow = GridView1.BottomPagerRow;
    TextBox numBox = (TextBox)GridView1.BottomPagerRow.FindControl("txtNewPageIndex");
    int inputNum = Convert.ToInt32(numBox.Text);
    GridView1.PageIndex = inputNum - 1;
    BindData();
  }
}

效果图展示及源码下载

GridView中如何自定义分页

关于GridView中如何自定义分页问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。


分享题目:GridView中如何自定义分页-创新互联
文章源于:http://bjjierui.cn/article/ddjjos.html

其他资讯