濮阳杆衣贸易有限公司

主頁 > 知識庫 > ASP.NET中ListView(列表視圖)的使用前臺綁定附源碼

ASP.NET中ListView(列表視圖)的使用前臺綁定附源碼

熱門標簽:電話機器人軟件銷售工作 蘋果手機凱立德地圖標注 玉林市機器人外呼系統(tǒng)哪家好 同安公安400電話怎么申請流程 申請400電話手續(xù) 百度ai地圖標注 預(yù)測式外呼系統(tǒng)使用說明 合肥電銷外呼系統(tǒng)哪家公司做的好 南陽外呼系統(tǒng)定制化
1.A,運行效果圖

 

1.B,源代碼
復(fù)制代碼 代碼如下:

%@ Page Language="C#" AutoEventWireup="true" CodeFile="DropLvw.aspx.cs" Inherits="DropLvw" %>

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

html xmlns="http://www.w3.org/1999/xhtml">
head runat="server">
title>無標題頁/title>
/head>
body>
form id="form1" runat="server">
div>
請選擇大分類:asp:DropDownList ID="drop" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="CategoryName"
DataValueField="CategoryID">
/asp:DropDownList>
asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]">
/asp:SqlDataSource>
hr />
該分類下的產(chǎn)品:br />
asp:ListView ID="lvw" runat="server" DataKeyNames="ProductID"
DataSourceID="SqlDataSource2">
ItemTemplate>
tr style="">
td>
asp:Label ID="ProductIDLabel" runat="server" Text='%# Eval("ProductID") %>' />
/td>
td>
asp:Label ID="ProductNameLabel" runat="server"
Text='%# Eval("ProductName") %>' />
/td>
td>
asp:Label ID="CategoryIDLabel" runat="server"
Text='%# Eval("CategoryID") %>' />
/td>
td>
asp:Label ID="UnitPriceLabel" runat="server" Text='%# Eval("UnitPrice") %>' />
/td>
/tr>
/ItemTemplate>
AlternatingItemTemplate>
tr style="">
td>
asp:Label ID="ProductIDLabel" runat="server" Text='%# Eval("ProductID") %>' />
/td>
td>
asp:Label ID="ProductNameLabel" runat="server"
Text='%# Eval("ProductName") %>' />
/td>
td>
asp:Label ID="CategoryIDLabel" runat="server"
Text='%# Eval("CategoryID") %>' />
/td>
td>
asp:Label ID="UnitPriceLabel" runat="server" Text='%# Eval("UnitPrice") %>' />
/td>
/tr>
/AlternatingItemTemplate>
EmptyDataTemplate>
table runat="server" style="">
tr>
td>
未返回數(shù)據(jù)。/td>
/tr>
/table>
/EmptyDataTemplate>
InsertItemTemplate>
tr style="">
td>
asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="插入" />
asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="清除" />
/td>
td>
nbsp;/td>
td>
asp:TextBox ID="ProductNameTextBox" runat="server"
Text='%# Bind("ProductName") %>' />
/td>
td>
asp:TextBox ID="CategoryIDTextBox" runat="server"
Text='%# Bind("CategoryID") %>' />
/td>
td>
asp:TextBox ID="UnitPriceTextBox" runat="server"
Text='%# Bind("UnitPrice") %>' />
/td>
/tr>
/InsertItemTemplate>
LayoutTemplate>
table runat="server">
tr runat="server">
td runat="server">
table ID="itemPlaceholderContainer" runat="server" border="0" style="">
tr runat="server" style="">
th runat="server">
ProductID/th>
th runat="server">
ProductName/th>
th runat="server">
CategoryID/th>
th runat="server">
UnitPrice/th>
/tr>
tr ID="itemPlaceholder" runat="server">
/tr>
/table>
/td>
/tr>
tr runat="server">
td runat="server" style="">
/td>
/tr>
/table>
/LayoutTemplate>
EditItemTemplate>
tr style="">
td>
asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
/td>
td>
asp:Label ID="ProductIDLabel1" runat="server"
Text='%# Eval("ProductID") %>' />
/td>
td>
asp:TextBox ID="ProductNameTextBox" runat="server"
Text='%# Bind("ProductName") %>' />
/td>
td>
asp:TextBox ID="CategoryIDTextBox" runat="server"
Text='%# Bind("CategoryID") %>' />
/td>
td>
asp:TextBox ID="UnitPriceTextBox" runat="server"
Text='%# Bind("UnitPrice") %>' />
/td>
/tr>
/EditItemTemplate>
SelectedItemTemplate>
tr style="">
td>
asp:Label ID="ProductIDLabel" runat="server" Text='%# Eval("ProductID") %>' />
/td>
td>
asp:Label ID="ProductNameLabel" runat="server"
Text='%# Eval("ProductName") %>' />
/td>
td>
asp:Label ID="CategoryIDLabel" runat="server"
Text='%# Eval("CategoryID") %>' />
/td>
td>
asp:Label ID="UnitPriceLabel" runat="server" Text='%# Eval("UnitPrice") %>' />
/td>
/tr>
/SelectedItemTemplate>
/asp:ListView>
asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductID], [ProductName], [CategoryID], [UnitPrice] FROM [Products] WHERE ([CategoryID] = @CategoryID)">
SelectParameters>
asp:ControlParameter ControlID="drop" DefaultValue="1" Name="CategoryID"
PropertyName="SelectedValue" Type="Int32" />
/SelectParameters>
/asp:SqlDataSource>
/div>
/form>
/body>
/html>

/web.config
復(fù)制代碼 代碼如下:

connectionStrings>
add name="NorthwindConnectionString" connectionString="Data
Source=.;Initial Catalog=Northwind;Integrated Security=True"
providerName="System.Data.SqlClient"/>
/connectionStrings>

1.C,資源下載
您可能感興趣的文章:
  • android二級listview列表實現(xiàn)代碼
  • Android通過LIstView顯示文件列表的兩種方法介紹
  • Android ExpandableListView展開列表控件使用實例
  • android開發(fā)教程之使用listview顯示qq聯(lián)系人列表
  • Android用ListView顯示SDCard文件列表的小例子
  • pp列表之分組ListView詳解
  • Android編程使用ListView實現(xiàn)數(shù)據(jù)列表顯示的方法
  • Android開發(fā)之ListView列表刷新和加載更多實現(xiàn)方法
  • listview控件實現(xiàn)點擊列表頭進行l(wèi)istview排序示例分享
  • Android ListView實現(xiàn)簡單列表功能

標簽:揚州 嘉興 南京 臺州 南京 南昌 海南 淄博

巨人網(wǎng)絡(luò)通訊聲明:本文標題《ASP.NET中ListView(列表視圖)的使用前臺綁定附源碼》,本文關(guān)鍵詞  ASP.NET,中,ListView,列表,視圖,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ASP.NET中ListView(列表視圖)的使用前臺綁定附源碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于ASP.NET中ListView(列表視圖)的使用前臺綁定附源碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    稻城县| 喀喇沁旗| 潞城市| 三河市| 同德县| 丘北县| 霍州市| 呼和浩特市| 修水县| 名山县| 贵南县| 寿光市| 深水埗区| 手机| 淄博市| 安吉县| 灵石县| 祁东县| 柏乡县| 阿尔山市| 岳阳县| 扎兰屯市| 酒泉市| 富蕴县| 静安区| 阿坝| 墨竹工卡县| 贵港市| 乌什县| 台山市| 萨嘎县| 辛集市| 精河县| 平阳县| 富顺县| 罗甸县| 威海市| 沙雅县| 双柏县| 扎兰屯市| 肃宁县|