Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > C#/.NET入门教程

ASP.NET repeater添加序号列的方法

来源:中文源码网    浏览:147 次    日期:2024-05-12 21:11:02
【下载文档:  ASP.NET repeater添加序号列的方法.txt 】


ASP.NET repeater添加序号列的方法
在项目开发过程中,会经常遇到ASP.NET repeater控件添加序号列,有些新手可能还不会,网上搜集整理了一些,需要的朋友可以参考下ASP.NET repeater添加序号列的方法 1、 <%# Container.ItemIndex + 1%> 2、 <%# this.rpResult.Items.Count + 1%> 3、在
中添加 function show() { var bj = document.all.tags("LABEL"); for (i=0;i 4、后台实现方法: 在.aspx里添加 在.cs里添加 ** void InitializeComponent() { this.Repeater1.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.Repeater1_ItemDataBound); this.Load += new System.EventHandler(this.Page_Load); } ** void Repeater1_ItemDataBound(object source, System.Web.UI.WebControls.RepeaterItemEventArgs e) { if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ((Label)e.Item.FindControl("Label1")).Text = Convert.ToString(e.Item.ItemIndex + 1); } } 根据条件添加html <%#Container.ItemIndex == 8 ? "
" : ""%>

相关内容