asp.net 在listview使用中,如何给insertitemtemplate的textbox添加日历扩展及多选扩展?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
您的访问请求被拒绝 403 Forbidden - ITeye技术社区
您的访问请求被拒绝
亲爱的会员,您的IP地址所在网段被ITeye拒绝服务,这可能是以下两种情况导致:
一、您所在的网段内有网络爬虫大量抓取ITeye网页,为保证其他人流畅的访问ITeye,该网段被ITeye拒绝
二、您通过某个代理服务器访问ITeye网站,该代理服务器被网络爬虫利用,大量抓取ITeye网页
请您点击按钮解除封锁&在ASP.NET 3.5中使用新的ListView控件[1]
在ASP.NET 3.5中使用新的ListView控件[1]
  ASP.NET中新的ListView控件为显示和CURD数据库操作提供了基于模板的布局,使之成为一项极好的方式,建立以数据为中心的Web应用程序。
  当你编写以用户为中心的应用程序时,总需要某种形式的数据集,起码来说,你需要从一个数据源如关系数据库或XML文件检索数据,在显示给用户之前先要进行格式化,尽管ASP.NET之前的版本就提供了以数据为中心的显示控件如GridView,这些控件缺乏专业Web开发人员需要的可自定义和可扩展特性,为了解决这个问题,ASP.NET3.5提供了一个新的控件ListView,它提供了非常优秀的自定义和扩展特性,使用这些特性,你可以以任何格式显示数据,使用模板和样式,同时用最少的代码执行CURD(创建、读取、更新、删除)操作。
  本文主要集中于使用新的ListView控件时数据访问步骤,同时还包括高级特性如编辑数据和处理事件。
  ListView控件入门
  ASP.NET提供的大部分数据绑定控件都是使用额外的标记自动封装显示数据,举例来说,GridView控件在一个HTML表格(&table&)中显示它的数据,每条记录显示一行(&tr&),每个字段显示为一个单元格(&td&),虽然你可以使用TemplateField组件自定义GridView的外观,但GridView的输出仍然是限制在一个table组件中的,但有时候你想要完全控制由数据绑定控件产生的HTML标记的外观,这正是ListView控件的优势,ListView控件不是使用额外的标记来封装它的输出内容,而是靠你指定的精确的HTML描述,使用ListView控件内置的模板就可以指定精确的标记,表1列出了ListView控件支持的模板。
  最关键的两个模板是LayoutTemplate和ItemTemplate,正如名字暗示的那样,LayoutTemplate为ListView控件指定了总的标记,而ItemTemplate指定的标记用于显示每个绑定的记录,例如:下面的代码显示了在ListView中由HTML table控制的一串项目。
&asp:ListView ID="..." runat="server" DataSourceID="..."&&LayoutTemplate&&table …….&&tr runat="server" ID="itemPlaceholder"&&/tr&&/table&&/LayoutTemplate&&ItemTemplate&&tr&&td&&%# Eval("Name") %&&/td&&/tr&&/ItemTemplate&&/asp:ListView&
  在前面的代码中,LayoutTemplate标记内的&tr&标记的ID是设置项目占位符(itemPlaceHolder),它告诉ListView通过&table&内的ItemTemplate产生的内容要放到什么地方,这就是为什么你需要单独定义LayoutTemplate和ItemTemplate模板的原因。
[1] &[] &[] &[] &
H3C认证Java认证Oracle认证
基础英语软考英语项目管理英语职场英语
.NETPowerBuilderWeb开发游戏开发Perl
二级模拟试题一级模拟试题一级考试经验四级考试资料
港口与航道工程建设工程法规及相关知识建设工程经济考试大纲矿业工程市政公用工程通信与广电工程
操作系统汇编语言计算机系统结构人工智能数据库系统微机与接口
软件测试软件外包系统分析与建模敏捷开发
法律法规历年试题软考英语网络管理员系统架构设计师信息系统监理师
高级通信工程师考试大纲设备环境综合能力
路由技术网络存储无线网络网络设备
CPMP考试prince2认证项目范围管理项目配置管理项目管理案例项目经理项目干系人管理
Powerpoint教程WPS教程
电子政务客户关系管理首席信息官办公自动化大数据
职称考试题目
就业指导签约违约职业测评
招生信息考研政治
网络安全安全设置工具使用手机安全
3DMax教程Flash教程CorelDraw教程Director教程
Dreamwaver教程HTML教程网站策划网站运营Frontpage教程
生物识别传感器物联网传输层物联网前沿技术物联网案例分析
互联网电信IT业界IT生活
Java核心技术J2ME教程
Linux系统管理Linux编程Linux安全AIX教程
Windows系统管理Windows教程Windows网络管理Windows故障
组织运营财务资本
视频播放文件压缩杀毒软件输入法微博
数据库开发Sybase数据库Informix数据库
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&2518人阅读
asp.net_AspNetPager(2)
asp.net_listview(3)
环境:VS2010,SQLServer2008 express
使用控件:ListView,AspNetPager v7.32
AspNetPager分页存储过程
ALTER PROCEDURE [dbo].[fy]
(@startIndex int,
@endIndex int)
with temptbl as (
SELECT ROW_NUMBER() OVER (ORDER BY UGID asc)AS Row, * from DJ_UserUnit )
SELECT * FROM temptbl where Row between @startIndex and @endIndex
AspNetPager分页控件获取记录总数存储过程
ALTER PROCEDURE [dbo].[fycount]
select count(*) from DJ_UserU
以上两个存储过程是必须的。也可以只要第一个分页存储过程,第二个总数用SQL语句。
下面开始编程:
DAL数据层基本操作方法:
第一个ExecuteScalar为获取记录总数的方法:
#region 返回执行的SQL语句或存储过程的第一行第一列,忽视其它行列,返回类型为object
/// &summary&
/// 返回执行的SQL语句或存储过程的第一行第一列,忽视其它行列,返回类型为object
/// &/summary&
/// &param name=&cmdText&&存储过程或SQL语句&/param&
/// &param name=&procType&&cmd类型,CommandType.StoredProcedure为存储过程,CommandType.Text为SQL&/param&
/// &returns&返回类型为object&/returns&
public object ExecuteScalar(string cmdText, CommandType procType)
using(cmd=new SqlCommand(cmdText,GetConn()))
mandType = procT
res=cmd.ExecuteScalar();
#endregion
第二个ExecuteQuery为分页存储过程操作方法
#region 执行带参数查询SQL语句或存储过程,返回DataTable
/// &summary&
/// 执行带参数查询SQL语句或存储过程,返回DataTable
/// &/summary&
/// &param name=&cmdText&&存储过程名或SQL语句&/param&
/// &param name=&paras&&参数&/param&
/// &param name=&procType&&cmd类型,CommandType.StoredProcedure为存储过程,CommandType.Text为SQL&/param&
/// &returns&返回DataTable&/returns&
public DataTable ExecuteQuery(string cmdText, SqlParameter[] paras, CommandType procType)
//TODO:执行带参数查询SQL语句或存储过程
DataTable dt = new DataTable();
cmd = new SqlCommand(cmdText, GetConn());
mandType = procT
//这里判断是否是存储过程。CommandType.StoredProcedure为存储过程,CommandType.Text为SQL
cmd.Parameters.AddRange(paras);
using (sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
dt.Load(sdr);
#endregion
结合以上两个基本方法,编写BLL业务逻辑层分页包装方法:
#region 获得记录总数
/// &summary&
/// 获得记录总数
/// &/summary&
/// &returns&&/returns&
public int UserUnit_Count() {
string cmdText = &fycount&;
res = (int)sqlhelper.ExecuteScalar(cmdText, CommandType.StoredProcedure);
#endregion
#region 分页显示
/// &summary&
/// 分页显示
/// &/summary&
/// &param name=&startIndex&&AspNetPager开始索引&/param&
/// &param name=&endIndex&&AspNetPager结束索引&/param&
/// &returns&&/returns&
public DataTable fy(int startIndex, int endIndex)
DataTable dta = new DataTable();
string cmdText = &fy&;
SqlParameter[] paras = new SqlParameter[] {
new SqlParameter(&@startIndex&,startIndex),
new SqlParameter(&@endIndex&,endIndex)
dta = sqlhelper.ExecuteQuery(cmdText, paras, CommandType.StoredProcedure);
#endregion
有了这些方法,就可以开始编写界面层了。
结合母版,随便写个ListView,然后拉入AspNetPager控件。
拉入AspNetPager控件的方法:
1、将AspNetPager.dll和AspNetPager.xml放入界面层Bin目录,然后引用AspNetPager.dll
2、在vs2010工具栏上点右键,选择“选择项”,然后选择AspNetPager.dll,这样,它就进入了工具栏。
界面前台,没什么说的,除了母版,就是一个listview和一个aspnetpager:
&%@ Page Title=&& Language=&C#& MasterPageFile=&~/manage.Master& AutoEventWireup=&true& CodeBehind=&test.aspx.cs& Inherits=&website.test& %&
&%@ Register assembly=&AspNetPager& namespace=&Wuqi.Webdiyer& tagprefix=&webdiyer& %&
&asp:Content ID=&Content1& ContentPlaceHolderID=&head& runat=&server&&
&/asp:Content&
&asp:Content ID=&Content2& ContentPlaceHolderID=&MenuTitle& runat=&server&&
&/asp:Content&
&asp:Content ID=&Content3& ContentPlaceHolderID=&SelectMenu& runat=&server&&
&/asp:Content&
&asp:Content ID=&Content4& ContentPlaceHolderID=&Content& runat=&server&&
&asp:ListView ID=&ListView1& runat=&server& DataKeyNames=&UGID& InsertItemPosition=&LastItem&&
&AlternatingItemTemplate&
&tr style=&background-color: #FAFAD2;color: #284775;&&
&asp:Button ID=&DeleteButton& runat=&server& CommandName=&Delete& Text=&删除& /&
&asp:Button ID=&EditButton& runat=&server& CommandName=&Edit& Text=&编辑& /&
&asp:Label ID=&UGIDLabel& runat=&server& Text='&%# Eval(&UGID&) %&' /&
&asp:Label ID=&UNameLabel& runat=&server& Text='&%# Eval(&UName&) %&' /&
&/AlternatingItemTemplate&
&EditItemTemplate&
&tr style=&background-color: #FFCC66;color: #000080;&&
&asp:Button ID=&UpdateButton& runat=&server& CommandName=&Update& Text=&更新& /&
&asp:Button ID=&CancelButton& runat=&server& CommandName=&Cancel& Text=&取消& /&
&asp:Label ID=&UGIDLabel1& runat=&server& Text='&%# Eval(&UGID&) %&' /&
&asp:TextBox ID=&UNameTextBox& runat=&server& Text='&%# Bind(&UName&) %&' /&
&/EditItemTemplate&
&EmptyDataTemplate&
&table runat=&server&
style=&background-color: #FFFFFF;border-collapse:border-color: #999999;border-style:border-width:1&&
未返回数据。&/td&
&/EmptyDataTemplate&
&InsertItemTemplate&
&tr style=&&&
&asp:Button ID=&InsertButton& runat=&server& CommandName=&Insert& Text=&插入& /&
&asp:Button ID=&CancelButton& runat=&server& CommandName=&Cancel& Text=&清除& /&
&asp:TextBox ID=&UNameTextBox& runat=&server& Text='&%# Bind(&UName&) %&' /&
&/InsertItemTemplate&
&ItemTemplate&
&tr style=&background-color: #FFFBD6;color: #333333;&&
&asp:Button ID=&DeleteButton& runat=&server& CommandName=&Delete& Text=&删除& /&
&asp:Button ID=&EditButton& runat=&server& CommandName=&Edit& Text=&编辑& /&
&asp:Label ID=&UGIDLabel& runat=&server& Text='&%# Eval(&UGID&) %&' /&
&asp:Label ID=&UNameLabel& runat=&server& Text='&%# Eval(&UName&) %&' /&
&/ItemTemplate&
&LayoutTemplate&
&table runat=&server& width=&100%&&
&tr runat=&server&&
&td runat=&server&&
&table ID=&itemPlaceholderContainer& runat=&server& border=&1&
style=&background-color: #FFFFFF;border-collapse:border-color: #999999;border-style:border-width:1font-family: Verdana, Arial, Helvetica, sans-& width=&100%&&
&tr runat=&server& style=&background-color: #FFFBD6;color: #333333;&&
&th runat=&server&&
&th runat=&server&&
&th runat=&server&&
UName&/th&
&tr ID=&itemPlaceholder& runat=&server&&
&tr runat=&server&&
&td runat=&server&
style=&text-align:background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-color: #333333;&&
&/LayoutTemplate&
&SelectedItemTemplate&
&tr style=&background-color: #FFCC66;font-weight:color: #000080;&&
&asp:Button ID=&DeleteButton& runat=&server& CommandName=&Delete& Text=&删除& /&
&asp:Button ID=&EditButton& runat=&server& CommandName=&Edit& Text=&编辑& /&
&asp:Label ID=&UGIDLabel& runat=&server& Text='&%# Eval(&UGID&) %&' /&
&asp:Label ID=&UNameLabel& runat=&server& Text='&%# Eval(&UName&) %&' /&
&/SelectedItemTemplate&
&/asp:ListView&
&/asp:Content&
&asp:Content ID=&Content5& ContentPlaceHolderID=&Footer& runat=&server&&
&%--AspNetPager样式,可随意调节--%&
&webdiyer:AspNetPager ID=&AspNetPager1& runat=&server& FirstPageText=&首页&
LastPageText=&尾页& NextPageText=&下一页& PageIndexBoxType=&DropDownList&
PrevPageText=&上一页& ShowPageIndexBox=&Auto& SubmitButtonText=&Go&
TextAfterPageIndexBox=&页& TextBeforePageIndexBox=&转到&
onpagechanged=&AspNetPager1_PageChanged&
CustomInfoHTML=&共%PageCount%页,当前为第%CurrentPageIndex%页,每页%PageSize%条&
ShowCustomInfoSection=&Left&&
&/webdiyer:AspNetPager&
&/asp:Content&
界面后台,以下三个方法,必不可少:
using System.Collections.G
using System.L
using System.W
using System.Web.UI;
using System.Web.UI.WebC
using BLL;
namespace website
public partial class test : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
int totalOrders = (int)new DJ_UserUnitManager().UserUnit_Count();
//获取记录集总数
AspNetPager1.RecordCount = totalO
//将总数赋给AspNetPager,此为不可少的参数
bindData();
void bindData()
//ListView绑定
ListView1.DataSource = new DJ_UserUnitManager().fy(AspNetPager1.StartRecordIndex, AspNetPager1.EndRecordIndex);
//通过分页存储过程进行ListView数据绑定。AspNetPager1.StartRecordIndex为开始参数,AspNetPager1.EndRecordIndex为结束参数,两参数为AspNetPager自带
ListView1.DataBind();
protected void AspNetPager1_PageChanged(object src, EventArgs e)
//分页控件事件,当分页时,显示控件ListView跟着变化。缺此方法不会变化。
bindData();
通过上面界面后台的内容可以看出,aspnetpager的基本操作只需要三个部份,一、获取记录总数,二、使用aspnetpager的开始结束索引进行数据绑定,第三,点击分页序号后再次进行绑定,进行分页显示。很简单吧。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:72601次
排名:千里之外
原创:17篇
转载:19篇
评论:14条
(1)(2)(6)(5)(22)当前位置导航:>>&&&&
ASP.NET 3.5中使用新的ListView控件
ASP.NET中新的ListView控件为显示和CURD数据库操作提供了基于模板的布局,使之成为一项极好的方式,建立以数据为中心的Web应用程序。
当你编写以用户为中心的应用程序时,总需要某种形式的数据集,起码来说,你需要从一个数据源如关系数据库或XML文件检索数据,在显示给用户之前先要进行格式化,尽管ASP.NET之前的版本就提供了以数据为中心的显示控件如GridView,这些控件缺乏专业Web开发人员需要的可自定义和可扩展特性,为了解决这个问题,ASP.NET3.5提供了一个新的控件ListView,它提供了非常优秀的自定义和扩展特性,使用这些特性,你可以以任何格式显示数据,使用模板和样式,同时用最少的代码执行CURD(创建、读取、更新、删除)操作。
本文主要集中于使用新的ListView控件时数据访问步骤,同时还包括高级特性如编辑数据和处理事件。
ListView控件入门
ASP.NET提供的大部分数据绑定控件都是使用额外的标记自动封装显示数据,举例来说,GridView控件在一个HTML表格( )中显示它的数据,每条记录显示一行(
),每个字段显示为一个单元格(
),虽然你可以使用TemplateField组件自定义GridView的外观,但GridView的输出仍然是限制在一个table组件中的,但有时候你想要完全控制由数据绑定控件产生的HTML标记的外观,这正是ListView控件的优势,ListView控件不是使用额外的标记来封装它的输出内容,而是靠你指定的精确的HTML描述,使用ListView控件内置的模板就可以指定精确的标记,表1列出了ListView控件支持的模板。
模板 用途 AlternatingItemTemplate
交替项目模板 用不同的标记显示交替的项目,便于查看者区别连续不断的项目 EditItemTemplate
编辑项目模板 控制编辑时的项目显示 EmptyDataTemplate
空数据模板 控制ListView数据源返回空数据时的显示 EmptyItemTemplate
空项目模板 控制空项目的显示 GroupSeparatorTemplate
组分隔模板 控制项目组内容的显示 GroupTemplate
组模板 为内容指定一个容器对象,如一个表行、div或span组件 InsertItemTemplate
插入项目模板 用户插入项目时为其指定内容 ItemSeparatorTemplate
项目分隔模板 控制项目之间内容的显示 ItemTemplate
项目模板 控制项目内容的显示 LayoutTemplate
布局模板 指定定义容器对象的根组件,如一个table、div或span组件,它们包装ItemTemplate或GroupTemplate定义的内容。 SelectedItemTemplate
已选择项目模板   指定当前选中的项目内容的显示最关键的两个模板是LayoutTemplate和ItemTemplate,正如名字暗示的那样,LayoutTemplate为ListView控件指定了总的标记,而ItemTemplate指定的标记用于显示每个绑定的记录,例如:下面的代码显示了在ListView中由HTML table控制的一串项目。   在前面的代码中,LayoutTemplate标记内的
标记的ID是设置项目占位符(itemPlaceHolder),它告诉ListView通过内的ItemTemplate产生的内容要放到什么地方,这就是为什么你需要单独定义LayoutTemplate和ItemTemplate模板的原因。   一个简单的数据绑定的例子你已经看到LisView控件支持的多个模板了,下一步是要创建一个简单的web站点,名字就叫做ListViewExample(你可以从/sourcecode/38579_tt_mainsource.zip下载该站点的示例代码),创建好web站点后,选择Web站点?添加新项目,添加一个新的ASP.NET页面,名字命名为SimpleListView.aspx(见清单1),这个页面将使用ListView控件从AdventureWorks示例数据库中的Product表显示产品数据。   清单1.ListView控件示例清单http://www.w3.org/1999/xhtml"& DataSourceID="productSource" DataKeyNames="ProductID"& style="width:460px"& PreviousPageText="&——" NextPageText="——&" /& Product ID : Text='' /& Name : Text='' /& Product Number : runat="server" Text='' /&  -------------------------------------------------------- ------------------   There are no products!   DataSourceMode="DataSet" ConnectionString="" SelectCommand="SELECT ProductID,Name,ProductNumber,Color,ListPrice FROM Production.Product"&在清单1中,SqlDataSource通过设置ConnectionString 和SelectCommand 属性控制从AdventureWorks数据库的Product表中检索数据,ConnectionString属性通过一个ASP.NET表达式从web.config文件获取连接字符串,在我的测试机上,连接字符串定义在web.config中,如:connectionString="server=localhost;uid=sa;pwd=thiru;database=AdventureWorks;"/&设置好SqlDataSource属性后,下一步是通过ListView控件显示数据,下面是在LayoutTemplate模板中的标记:style="width:460px"& PreviousPageText="&——" NextPageText="——&" /& LayoutTemplate模板定义了ListView控件输出内容的容器,除了在ListView控件顶层定义了table外,LayoutTemplate模板还定义了,它为ListView控件提供了分页功能,DataPager让你可以为任何数据绑定控件实现IpageableItemContainer进行数据分页并显示导航控制。
有两种方法使数据分页(DataPager)和数据绑定(data-bound)联合使用:
1、设置DataPager 的PagedControlID属性为data-bound的名字。2、将DataPager置于data-bound层次体系之下,对于ListView控件,你可以将DataPager置于LayoutTemplate组件内。
设置DataPager的PageSize属性,它控制每页显示的数据行数,你也可以在页面提交到服务器时通过设置QueryStringField属性实现。
在DataPager内,你指定NumericPageField模板,它可以让用户输入一个页号,然后按照页号进行跳转,如:
PreviousPageText="&--"NextPageText="--&" /&
ItemTemplate组件为每个记录的明细提供了标记。图1显示了在浏览器中导航到该页面的输出。
图1.ListView示例:通过数据绑定ListView控件到SqlDataSource控件检索Product表中部分数据产生的输出
用ListView控件编辑数据
正如你所看到的,使用ListView控件显示数据相对要直接得多,但你还可以让用户在ListView中直接编辑数据,添加一个新页面ListViewEditExample.aspx,它的代码如清单2所示。
清单2.编辑ListView
http://www.w3.org/1999/xhtml"&
DataKeyNames="DepartmentID" runat="server" OnItemUpdated="deptsView_ItemUpdated"OnPagePropertiesChanged="deptsView_PagePropertiesChanged"&
runat="server" id="tblProducts"&
Group Name
PageSize="3"&
ShowLastPageButton="True" FirstPageText="|&& " LastPageText=" &&|" NextPageText=" & " PreviousPageText=" & " /&
Text='' /&
Text='' /&
CommandName="Edit" /&
Text='' MaxLength="50" /&
CommandName="Update" Text="Update" /& CommandName="Cancel" Text="Cancel" /&
ConnectionString=""SelectCommand="SELECT [DepartmentID],[Name],[GroupName] FROM HumanResources.Department" UpdateCommand="UPDATE HumanResources.Department SET Name = @Name, GroupName = @GroupName WHERE DepartmentID = @DepartmentID"&
Font-Bold="true" /&
清单2的代码说明了如何使用EditItemTemplate组件在编辑模式下生成内容,
上一篇: 下一篇:
赞助商链接ASP.NET中listview控件的用法?-.NET技术/ASP.NET-asp.net-电脑编程网ASP.NET中listview控件的用法?-.NET技术/ASP.NET作者:daizhen256 和相关&&一开始报错说:必须在 ListView“itemPlaceholder”上指定项占位符。可通过将控件的 ID 的属性设置为“itemPlaceholder”来指定项占位符。项占位符控件还必须指定 runat=&server&。于是我在其下面添加了一个placeholder控件,并将listview的itemplaceholderid改成了后添加的placeholder控件的ID,结果还是报一样的错,我究竟错在哪呢?------回答---------------其他回答(40分)---------C# code
LayoutTemplate 模板是 ListView 控件所必需的。LayoutTemplate 内容必须包含一个占位符控件,例如由 ItemTemplate 模板定义的项表行 (tr) 元素。占位符控件必须将 runat 属性 (Attribute) 设置为“server”,将 ID 属性 (Attribute) 设置为 ItemPlaceholderID 或 GroupPlaceholderID 属性 (Property) 的值(具体取决于 ListView 控件是否使用组)。
例如:
前端代码:
ListView演示前端代码
&:ListView ID=&ListView1& runat=&server&&
&ItemTemplate&
&tr&
&td runat=&server& style=&&&
&:Label ID=&idLabel& runat=&server& Text='&%# Eval(&name&) %&' /&
&br /&
&/td&
&td&
&asp:Label ID=&xLabel& runat=&server& Text='&%# Eval(&Age&) %&' /&
&br /&
&/td&
&/tr&
&/ItemTemplate&
&LayoutTemplate&
&table runat=&server& border=&0& style=&&&
[color=#FF0000]&tr runat=&server& id=&itemPlaceholder& /&[/color]
&/table&
&/LayoutTemplate&
&/asp:ListView&
------回答---------------其他回答(40分)---------
C# code
LayoutTemplate 模板是 ListView 控件所必需的。LayoutTemplate 内容必须包含一个占位符控件,例如由 ItemTemplate 模板定义的项表行 (tr) 元素。占位符控件必须将 runat 属性 (Attribute) 设置为“server”,将 ID 属性 (Attribute) 设置为 ItemPlaceholderID 或 GroupPlaceholderID 属性 (Property) 的值(具体取决于 ListView 控件是否使用组)。
例如:
前端代码:
ListView演示前端代码
&asp:ListView ID=&ListView1& runat=&server&&
&ItemTemplate&
&tr&
&td runat=&server& style=&&&
&asp:Label ID=&idLabel& runat=&server& Text='&%# Eval(&name&) %&' /&
&br /&
&/td&
&td&
&asp:Label ID=&xLabel& runat=&server& Text='&%# Eval(&Age&) %&' /&
&br /&
&/td&
&/tr&
&/ItemTemplate&
&LayoutTemplate&
&table runat=&server& border=&0& style=&&&
[color=#FF0000]&tr runat=&server& id=&itemPlaceholder& /&[/color]
&/table&
&/LayoutTemplate&
&/asp:ListView&
相关资料:|||||||ASP.NET中listview控件的用法?-.NET技术/ASP.NET来源网络,如有侵权请告知,即处理!编程Tags:                &                    

我要回帖

更多关于 listview使用 的文章

 

随机推荐