如何在repeater里添加序号

发布时间:2025-05-07 点击:3
1、<itemtemplate>
<tr><td>
<%# container.itemindex + 1%>
</td></tr>
</itemtemplate>
2、<itemtemplate>
<tr><td>
<%# this.rpresult.items.count + 1%>
</td></tr>
</itemtemplate>
3、
在<form></form>中添加<label id='dd' ></label>
<body nload='show()'>
<script. language='jscript'>
function show()
{
var bj = document.all.tags('label');
for (i=0;i<obj.length;i++)
{
document.all['dd'][i].innerhtml=i+1;
}
}
</script>
4、
后台实现方法:
在.aspx里添加<asp:label id='label1' runat='server'></asp:label>
在.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);
}
}


连云港网站建设-连云港制作网站之前要了解的几个基本要点
有哪些方法能让网络推广达到最大效果
新站在百度审核期间怎么操作
H5页面制作免费工具大集合
想要做好网络营销这几点很重要
高品质的信丰营销型网站建设该怎么做?
【网站优化】SEO标题设置技巧之如何避免百度细雨算法
智能运营网站