自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

DetailsView分頁顯示數(shù)據(jù)

開發(fā) 后端
本文簡單介紹了DetailsView分頁顯示數(shù)據(jù)的設置方法。簡單的說,通過檢查DetailsView的智能感知中檢查Enable Paging checkbox是否被勾選上,就可以分頁查看所有的數(shù)據(jù)了。

在CustomFormatting文件夾下新建一個CustomColors.aspx頁面,從工具箱中拖出一個DetailsView控件到頁面中,設置ID為ExpensiveProductsPriceInBoldItalic

綁定到一個新的數(shù)據(jù)源中,并配置此數(shù)據(jù)源到業(yè)務對象ProductsBLL類中的GetProducts()方法,這個的詳細實現(xiàn)步驟已經(jīng)在前面詳細介紹過了,這里就忽略了

當您綁定ObjectDataSource到DetailsView時,我們可以修改一下字段列表,我選擇移除了ProductID, SupplierID, CategoryID, UnitsInStock, UnitsOnOrder, ReorderLevel和那些不被綁定的字段,他們將不會顯示在DetailsView列表中,而那些留下來的我們可以重命名他們,還可以修改他們的顯示格式. 我還清空了DetailsView的Height和Width屬性,這樣當顯示的只有一條數(shù)據(jù)時不會出現(xiàn)樣式的混亂。當然我們面對的數(shù)據(jù)絕不只有一條這么少,顯示怎么辦呢?我們可以檢查DetailsView的智能感知中檢查Enable Paging checkbox是否被勾選上, 這樣我們可以分頁查看所有的數(shù)據(jù)了。

在DetailsView的值能感知中檢查Enable Paging屬性是否被勾選上 

DetailsView分頁: 在DetailsView的值能感知中檢查Enable Paging屬性是否被勾選上

在經(jīng)過這些改變后,DetailsView的代碼更改為

  1. < asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False" DataKeyNames="ProductID" DataSourceID="ObjectDataSource1" EnableViewState="False">  
  2.  
  3.     < Fields>  
  4.  
  5.         < asp:BoundField DataField="ProductName" HeaderText="Product" SortExpression="ProductName" />  
  6.  
  7.         < asp:BoundField DataField="CategoryName" HeaderText="Category" ReadOnly="True" SortExpression="CategoryName" />  
  8.  
  9.         < asp:BoundField DataField="SupplierName" HeaderText="Supplier" ReadOnly="True" SortExpression="SupplierName" />  
  10.  
  11.         < asp:BoundField DataField="QuantityPerUnit" HeaderText="Qty/Unit" SortExpression="QuantityPerUnit" />  
  12.  
  13.         < asp:BoundField DataField="UnitPrice" DataFormatString="{0:c}" HeaderText="Price" 
  14.  
  15.             HtmlEncode="False" SortExpression="UnitPrice" />  
  16.  
  17.     < /Fields>  
  18.  
  19. < /asp:DetailsView>  
  20.  

您這時可以按F5執(zhí)行看看DetailsView分頁效果

DetailsView控件一次顯示一個數(shù)據(jù) 

DetailsView分頁: DetailsView控件一次顯示一個數(shù)據(jù)

【編輯推薦】

  1. ASP.NET 2.0數(shù)據(jù)教程:添加和配置ObjectDataSource控件
  2. ASP.NET 2.0數(shù)據(jù)教程:給每個部分添加Default.aspx頁面
  3. ASP.NET 2.0數(shù)據(jù)教程:添加breadcrumb導航
  4. ASP.NET 2.0數(shù)據(jù)教程:SiteMapDataSource控件
  5. ASP.NET 2.0數(shù)據(jù)教程:添加站點地圖
責任編輯:book05 來源: 博客堂
相關(guān)推薦

2009-07-27 10:48:53

ASP.NET Det

2009-07-27 16:31:19

ASP.NET Det

2010-11-29 09:45:30

Sybase分頁

2009-12-28 15:38:36

ADO.NET分頁

2020-05-20 16:54:47

數(shù)據(jù)分頁顯示函數(shù)

2010-05-17 17:35:30

MySQL數(shù)據(jù)庫

2009-07-27 16:46:07

DetailsView

2022-01-10 10:12:58

MySQL分頁數(shù)據(jù)

2009-08-04 14:23:36

ASP.NET查詢分頁

2009-07-03 14:23:49

JSP數(shù)據(jù)分頁

2009-07-27 16:53:15

ASP.NET 2.0

2010-09-17 10:26:01

iPhone

2012-07-23 14:30:33

Oracle

2011-04-19 11:02:57

數(shù)據(jù)庫分頁

2010-03-19 09:17:16

ASP.NET MVC

2011-05-30 15:58:29

Android ListView 數(shù)據(jù)

2012-09-18 09:39:57

Linq項目高效

2010-09-06 11:40:06

SqlServer語句

2024-07-25 09:15:39

2009-08-07 09:20:26

DataPager數(shù)據(jù)
點贊
收藏

51CTO技術(shù)棧公眾號