全国统一热线:
028-86758058
18980748058
购买流程
付款方式
常见问题
在线提问
续租服务
购物车(
0
件)
用户名:
密 码:
记住
首 页
HOME
域名注册
DOMAIN
虚拟主机
WEB HOST
成品网站超市
AUTO Site
VPS主机
VPS SERVER
云 主 机
CLOUD HOST
租用托管
SERVER
海外主机
HK HOST
代理专区
AGENT
客服中心
SERVICE
站长教程
SERVICE
欢迎光临西部数据云计算中心,我们将竭诚为您提供最优质的服务!
中文域名
域名转入
域名转出
DNS管理
动态域名
获取域名证书
域名停放
域名过户
集群主机
双线主机
基本主机
港台主机
论坛主机
Linux主机
Vip合租主机
超G型主机
ASP.net主机
Java主机
智能建站主机
网店主机
美国主机
数据库
成品网站超市
智能建站主机
集群VPS主机
国内VPS主机
香港VPS主机
美国VPS主机
云主机介绍
云主机购买
服务器租用
主机托管
常见问题
香港主机
港台主机
美国主机
国内免备案
步骤流程
代理级别
代理合同
代理模式
代理优势
在线申请
产品列表
常见问题
代理商分布图
常见问题
有问必答
跟踪提问
购买流程
产品价格
付款方式
常用软件
网站备案
续租服务
汇款确认
相关文档
联系我们
域名资讯
主机资讯
行业动态
网页制作
php教程
mysql教程
域名资讯
云计算资讯
网络编程
您当前的位置:
首页
>
网络编程
>
Net教程
ASP.NET repeater添加序号列的方法
时间:2015-01-29 来源:互联网 作者:佚名
在项目开发过程中,会经常遇到ASP.NET repeater控件添加序号列,有些新手可能还不会,网上搜集整理了一些,需要的朋友可以参考下
ASP.NET repeater添加序号列的方法
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);
}
}
根据条件添加html
<%#Container.ItemIndex == 8 ? "<br><a href = 'http://www.ginchan.com.tw/' target='_blank'><img style='width:338px;heigh:70px' src='/ImportAD/ADmid.gif'> </a>" : ""%>
来顶一下
返回首页
推荐资讯
ASP.NET页面请求处理介绍
HttpRuntime类页面请求先给可以处理原始HTTP请求的对象处理,
dataGrid 多维表头、表头跨行跨列设
dataGrid 其实就是一个html table想清楚这个以后,要设置多
相关文章
Repeater对数据进行格式化处理
扩展了Repeater控件的EmptyDataTemplate模板功能
repeater隔行换色与鼠标停留在上面达到变色效果
Repeater控件分别绑定数组和ArrayList实现思路
Repeater与ListView功能概述及使用介绍
ASP.NET中repeater嵌套实现代码(附源码)
datalist,Repeater和Gridview的区别分析
Repeater控件动态变更列(Header,Item和Foot)信息实现思
Repeater的FooterTemplate显示某列总计思路与代码
Repeater控件数据导出Excel(附演示动画)
栏目更新
栏目热门
返回首页
关于我们
联系我们
付款方式
价格总览
资讯中心
友情链接
媒体关注
有问必答
投诉建议
网站备案
《中华人民共和国增值电信业务经营许可证》编号:川B2-20080058号
官方网址:
xibushuju.com
西部数据
Copyright © 2002~2015
天府快车
版权所有
电话总机:
028-86758058
(50线) 传真:
028-86758058