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

在ASP.NET GridView中顯示產(chǎn)品信息

開發(fā) 后端
本文簡單介紹了如何在GridView中顯示產(chǎn)品信息。

要在ASP.NET GridView中顯示產(chǎn)品信息,首先添加一個GridView到FormView的下方,設(shè)置ID為HighlightCheapProducts.我們之前已經(jīng)設(shè)置了一個ObjectDataSource來獲取產(chǎn)品數(shù)據(jù),現(xiàn)在我們綁定GridView到ObjectDataSource. 之后,編輯GridView的綁定列包含產(chǎn)品的name.categorie,price屬性。完成之后ASP.NET GridView的代碼如下:

  1. < asp:GridView ID="HighlightCheapProducts" runat="server" AutoGenerateColumns="False" 
  2.  
  3.     DataKeyNames="ProductID" DataSourceID="ObjectDataSource1" EnableViewState="False">  
  4.  
  5.     < Columns>  
  6.  
  7.         < asp:BoundField DataField="ProductName" HeaderText="Product" SortExpression="ProductName" />  
  8.  
  9.         < asp:BoundField DataField="CategoryName" HeaderText="Category" ReadOnly="True" SortExpression="CategoryName" />  
  10.  
  11.         < asp:BoundField DataField="UnitPrice" DataFormatString="{0:c}" HeaderText="Price" 
  12.  
  13.             HtmlEncode="False" SortExpression="UnitPrice" />  
  14.  
  15.     < /Columns>  
  16.  
  17. < /asp:GridView>  
  18.  

下圖顯示瀏覽器查看的結(jié)果

GridView顯示產(chǎn)品的name, category, price 

ASP.NET GridView: GridView顯示產(chǎn)品的name, category, price

【編輯推薦】

  1. ASP.NET 2.0數(shù)據(jù)教程:SelectMethod屬性的使用
  2. ASP.NET 2.0數(shù)據(jù)教程:在業(yè)務(wù)邏輯層添加方法
  3. ASP.NET 2.0數(shù)據(jù)教程:為TableAdapter添加方法
  4. ASP.NET 2.0數(shù)據(jù)教程:使用一個硬編碼參數(shù)值
  5. ASP.NET 2.0數(shù)據(jù)教程:綁定到ObjectDataSource
責(zé)任編輯:book05 來源: 博客堂
相關(guān)推薦

2009-07-27 16:09:05

GridView顯示數(shù)

2009-07-27 16:31:19

ASP.NET Det

2009-07-27 10:12:37

GridView和Ob

2009-07-27 15:58:25

添加GridView

2009-07-24 16:15:00

擴展ASP.NET G

2009-07-24 15:35:00

ASP.NET Gri

2009-07-20 18:02:48

GridView控件ASP.NET 2.0

2009-07-27 10:48:53

ASP.NET Det

2009-07-27 16:22:54

GridView選擇行

2009-08-14 13:20:29

ASP.NET Gri

2012-04-06 13:52:58

ASP.NET

2009-07-29 15:51:29

ASP.NET中執(zhí)行w

2012-04-09 10:34:21

jQuery

2009-07-23 14:08:58

2012-11-08 10:27:22

WEB產(chǎn)品架構(gòu)架構(gòu)

2009-07-23 16:44:51

AdRotator控件ASP.NET

2009-01-16 13:17:16

AjaxASP.NET.NET

2009-06-12 09:24:34

ASP.NET窗體ASP.NET MVC

2009-12-11 16:28:23

ASP.NET 2.0

2009-07-22 17:45:35

ASP.NET教程
點贊
收藏

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