如何在repeater里添加序號

2022-06-01    分類: 網(wǎng)站建設(shè)

1、

<%# Container.ItemIndex + 1%>

2、

<%# this.rpResult.Items.Count + 1%>

3、

中添加


      function show()
   {
var bj = document.all.tags('LABEL');
for (i=0;i{
document.all['dd'][i].innerHTML=i+1;
}
   }
  

4、

后臺實現(xiàn)方法:

在.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);
   }
}

網(wǎng)頁題目:如何在repeater里添加序號
URL分享:http://bm7419.com/news/162294.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動網(wǎng)站建設(shè)、Google、云服務(wù)器、做網(wǎng)站定制開發(fā)、網(wǎng)頁設(shè)計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營