好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > GridView自定義分頁實例詳解(附demo源碼下載)

GridView自定義分頁實例詳解(附demo源碼下載)

熱門標簽:濮陽外呼電銷系統怎么樣 地圖標注的公司有哪些 地圖標注專業團隊 遂寧市地圖標注app 塔城代理外呼系統 天心智能電銷機器人 代理接電話機器人如何取消 地圖定位圖標標注 400電話辦理哪家性價比高

本文實例講述了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的不同標記中,舉例如下:

RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" CssClass="gvRow" />
HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" CssClass="gvHeader" />
AlternatingRowStyle BackColor="#F7F7F7" CssClass="gvAlternatingRow" />

Pager分頁模板

其中gridview下方的換頁代碼為:

PagerTemplate>
  table width="100%" style="font-size:12px;">
    tr>
    td style="text-align: right">
      第asp:Label ID="lblPageIndex" runat="server" Text='%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'>/asp:Label>頁
      /共asp:Label ID="lblPageCount" runat="server" Text='%# ((GridView)Container.Parent.Parent).PageCount %>'>/asp:Label>頁nbsp;nbsp;
     asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page" Visible="%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">首頁/asp:LinkButton>
     asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page" Visible="%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">上一頁/asp:LinkButton>
     asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page" Visible="%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">下一頁/asp:LinkButton>
     asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page" Visible="%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">尾頁/asp:LinkButton>
     asp:TextBox ID="txtNewPageIndex" runat="server" Text='%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' Width="20px" AutoPostBack="true" >/asp:TextBox>
     asp:LinkButton ID="btnGo" runat="server" CommandArgument="GO" CommandName="Page" Text="GO" OnClick="btnGo_Click">/asp:LinkButton>
    /td>
    /tr>
  /table>
/PagerTemplate>

觸發事件

方法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();
  }
}

效果圖展示及源碼下載

完整實例代碼點擊此處本站下載。

希望本文所述對大家asp.net程序設計有所幫助。

您可能感興趣的文章:
  • ASP.NET數據綁定GridView控件使用技巧
  • 淺析GridView中顯示時間日期格式的問題
  • Gridview利用DataFormatString屬性設置數據格式的方法
  • GridView中日期不顯示時分秒的完美解決方法

標簽:宜春 婁底 吉林 重慶 麗江 汕頭 本溪 河南

巨人網絡通訊聲明:本文標題《GridView自定義分頁實例詳解(附demo源碼下載)》,本文關鍵詞  GridView,自定義,分頁,實例,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《GridView自定義分頁實例詳解(附demo源碼下載)》相關的同類信息!
  • 本頁收集關于GridView自定義分頁實例詳解(附demo源碼下載)的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 欧美人体做爰大胆视频| 国产做受视频120秒试看| 全彩本子口工18禁无遮H图片| 美女视频黄视大全视频免费的| 大乳bOObs巨大吃奶青少年| 暖暖爱视频免费| 国产精品白丝喷水在线观看者相| 成人福利视频网址| 绝对掌控(骨科/年上)| 性欧美XXX老师护士| 蜜桃成熟时 电影| 变女好爽我要h| 巜在丈面前被耍了无删减版| 一区二区三区欧美日韩国产| 黄色最新网址| 国产人妻精品一区二区三| 欧美一区=区三区| 潘金莲张开腿被×小说| 房东把我弄的高潮三次| 亚洲 欧美 自拍 第15页| 少女免费的高清电影有哪些| 26uuu免费看成人AV| 麻豆精品秘?国产传媒MV视频| 久久精品94精品久久精品动漫| 魔音音乐app最新版下载| 男女啪啪120秒试看免费毛片| 日日摸夜夜添无码亚洲 | 他扒开我的内裤吻我下边| 妞妞影视av一区二区三区| 激情国产白嫩美女在线观看| 另类sM一区二区三区免费视频| 久久久无码精品亚洲A片消消乐| 肉体奉公手机在线播放| GOGO人体大胆裸体无码| ???自慰调教av大师| 好叼操这里只有精品| 欧美一级特黄AAAAAA片| 张筱雨沙发上张开腿| 蜜臀91丨九色丨蝌蚪老版| 久久99精品国产片免费男男| 中国成**女毛茸茸|