偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

使用ASP.NET 2.0 FormView顯示數(shù)據(jù)

開發(fā) 后端
本文介紹了如何在FormView中顯示產(chǎn)品信息。ASP.NET 2.0 FormView與ObjectDataSource的綁定,和DetailsView等控件是類似的。

ASP.NET 2.0 FormView:添加一個FormView到CustomColors.aspx中,設置其ID為LowStockedProductsInRed,像前一個步驟一樣綁定數(shù)據(jù)到ObjectDataSource中,這將在FormView中創(chuàng)建ItemTemplate, EditItemTemplate, 和InsertItemTemplate . 移除EditItemTemplate和InsertItemTemplate 并在 ItemTemplate 中僅包含ProductName 和UnitsInStock 項, 在智能感知中檢查Allow Paging(分頁)標記是否被選上

在這些操作后FormView的代碼大概會成這樣

  1. < asp:FormView ID="LowStockedProductsInRed" runat="server" DataKeyNames="ProductID" 
  2.  
  3.     DataSourceID="ObjectDataSource1" AllowPaging="True" EnableViewState="False">              
  4.  
  5.     < ItemTemplate>  
  6.  
  7.         < b>Product:< /b>  
  8.  
  9.         < asp:Label ID="ProductNameLabel" runat="server" Text='< %# Bind("ProductName") %>'>  
  10.  
  11.         < /asp:Label>< br />  
  12.  
  13.         < b>Units In Stock:< /b>  
  14.  
  15.         < asp:Label ID="UnitsInStockLabel" runat="server" Text='< %# Bind("UnitsInStock") %>'>  
  16.  
  17.         < /asp:Label>  
  18.  
  19.     < /ItemTemplate>  
  20.  
  21. < /asp:FormView>  
  22.  

ASP.NET 2.0 FormView的代碼。注意ItemTemplate 包含的代碼:

◆靜態(tài)HTML – “Product:” 和 “Units In Stock:” 包含 < br /> 和 < b> 元素.

◆Web 控件– 兩個Label控件, ProductNameLabel 和UnitsInStockLabel.

◆綁定表達式 –< %# Bind("ProductName") %> 和< %# Bind("UnitsInStock") %> 表達式, 綁定值到Label的Text屬性上

以上就實現(xiàn)了在ASP.NET 2.0 FormView中顯示數(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 來源: 博客堂
相關推薦

2009-07-21 15:27:12

ASP.NET 2.0

2009-07-27 16:09:05

GridView顯示數(shù)

2009-01-07 11:38:22

ASP.NET.NET錯誤記錄

2009-07-28 14:06:28

ASP.NET 2.0

2009-07-22 17:21:27

ASP.NET 2.0

2009-07-27 09:39:04

SelectMetho

2009-07-24 17:15:52

SiteMapData

2009-07-22 17:23:03

XmlDataSourASP.NET 2.0

2009-07-30 15:17:16

ASP.NET 2.0

2009-12-03 13:34:36

Visual Stud

2009-07-23 14:08:58

2009-07-21 15:55:59

使用Web PartsASP.NET 2.0

2009-07-24 12:41:21

BLL類

2009-07-24 16:37:04

創(chuàng)建母版頁asp.net 2.0

2009-08-05 17:26:25

ASP.NET 2.0

2009-07-27 03:21:00

breadcrumb導

2009-08-05 17:43:48

ASP.NET 2.0

2009-07-27 16:22:54

GridView選擇行

2009-07-27 09:01:44

ObjectDataS

2009-07-24 17:08:31

添加站點地圖asp.net
點贊
收藏

51CTO技術棧公眾號