repeater 控件嵌套
为什么80%的码农都做不了架构师?>>>
页面代码:
<asp:Repeater ID="RepSort1" runat="server" OnItemDataBound="RepSort1_ItemDataBound"><ItemTemplate><table><tr><th><a href='Show.aspx?sortid=<%#Eval("ID") %>'><%#Eval("TypeName") %></a></th></tr><tr><td ><%#Eval("ID") %></td></tr><asp:Repeater ID="RepSort2" runat="server" OnItemDataBound="RepSort2_ItemDataBound"><ItemTemplate><tr><td class="mc"><%#Eval("TypeName") %></td><td><asp:Repeater ID="RepSort3" runat="server"><ItemTemplate><a href='#'><%#Eval("TypeName")%></a></ItemTemplate></asp:Repeater></td></tr></ItemTemplate></asp:Repeater></table></ItemTemplate>
</asp:Repeater>
后台代码:
protected void RepSort1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem){Repeater rep = e.Item.FindControl("RepSort2") as Repeater;DataRowView rowv = (DataRowView)e.Item.DataItem;string pid=rowv["id"].ToString();rep.DataSource = GetItem(pid.ToString());rep.DataBind();}
}protected void RepSort2_ItemDataBound(object sender, RepeaterItemEventArgs e)
{if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem){Repeater rep = e.Item.FindControl("RepSort3") as Repeater;DataRowView rowv = (DataRowView)e.Item.DataItem;string pid = rowv["id"].ToString();rep.DataSource = GetItem(pid.ToString());rep.DataBind();}
}public DataSet GetItem(string pid)
{SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);SqlCommand com = new SqlCommand("select * from [P-Type] where pid="+pid, con);SqlDataAdapter da = new SqlDataAdapter(com);DataSet ds = new DataSet();da.Fill(ds);return ds;
}
转载于:https://my.oschina.net/i33/blog/93753
repeater 控件嵌套相关推荐
- Repeater控件嵌套Repeater控件
此篇为Repeater控件嵌套Repeater控件教程,你可以从下面相关链接下载到教程视频与源程序. 视频: 文件格式:.wmv:大小21,401KB:长度:00:16:58. 下载地址:http:/ ...
- 关于 Repeater 控件嵌套的使用。在嵌套中添加 其它控件(如:按钮),并影响其它控件的方法,很重要哦,测试通过。...
这里的Repeater 嵌套,是指在 外层的Repeater的 ItemTemplate 中 又添加了一个 Repeater ,并且在两层的Repeater中都添加了一个Button控件.我们要实现两 ...
- Repeater控件嵌套使用
前台页面代码: <ul> <asp:Repeater ID="rptClass1" runat="server" On ...
- 使用嵌套的Repeater控件显示分级数据
作者:wincheer 来自:Asp.Net中文专业网 简介 本文描述如何使用嵌套的Repeater 控件来显示分级数据 .当然了,你也可以将这一技术应用到其他的列表绑定控件上去,比如DataGri ...
- repeater 控件ajax绑定数据源,用 DataList 和 Repeater 控件显示数据(C#) | Microsoft Docs...
使用 DataList 和 Repeater 控件显示数据 (C#) 09/13/2006 本文内容 在前面的教程中,我们使用了 GridView 控件来显示数据. 从本教程开始,我们将介绍如何生成包 ...
- repeater控件 php,Repeater控件实现编辑、更新、删除操作
如何在Repeater控件中实现像GridView控件一样的编辑.更新.删除功能? 下面给出示例 vs.net2008(C#)下编写.来自 admin10000.com 后台.cs代码protecte ...
- 在 DataList 和 Repeater 控件中定制按钮46
简介 在前面十七个DataList 控件和 Repeater 控件教程中,我们创建了一些只读示例和一些编辑和删除示例.要在 DataList 控件中方便地进行编辑和删除,我们为 DataList 控件 ...
- Datalist控件,Repeater控件如何分页?
Asp.net提供了三个功能强大的列表控件:DataGrid.DataList和Repeater控件,但其中只有DataGrid控件提供分页功能.相对DataGrid,DataList和Repeate ...
- Repeater控件的分页问题
作者:zhoubin@mail.sdu.edu.cn 以前做ASP的时间不算短,可是做ASP.NET我是个新手.前几天做项目,遇到一个问题,要求比较复杂的数据格式显示,用DataGrid非常难实现,后 ...
最新文章
- HP 服务器 iLO 远程控制软件 介绍
- 怎么在python下载网站内容-python从网站上下载东西
- 占内存小的qq_手机内存空间告急,这些办法就能轻松搞定!
- idea创建多模块Springboot项目、导入多模块、删除多模块
- 实用的 Python 之 feedparser
- Go语言实战-golang操作Mongodb
- android怎么用apk,手机如何安装APK应用教程 小白操作安卓系统教程 (全文)
- (翻译)反馈循环模式(Feedback loops)
- 手机android怎么开机画面,Android使用BroadcastReceiver实现手机开机之后显示画面的功能...
- workman用户组
- 网易2019实习生招聘笔试-牛牛的闹钟
- hangfire mysql_.NET之Hangfire快速入门和使用
- 中间选民定理(迭代剔除劣势策略,换位思考)
- Android混淆发布依赖
- 枢轴点(Pivot Point)系统
- ValueError: Variable eval_net/l1/w1 already exists, disallowed. Did you mean to set reuse=True or...
- 数据结构5.2图的存储与遍历
- 心向天蓝,Python学习第一章之列表一
- 2022-2028全球机器人底盘行业调研及趋势分析报告
- BLE:CC2540学习笔记
热门文章
- android通知栏打开actvity,Android实现点击通知栏后,先启动应用再打开目标Activity...
- linux 格式化 dvd,linux 服务器分区格式化相关知识 -mount
- android textview 设置字体,Android TextView设置字体风格
- mysql和oracle表的互导_oracle到mysql的导数据方式(适用于任意数据源之间的互导)...
- 测试第十七届智能车竞赛信标灯-初步测试
- Arduino IDE增加ATmega32开发选项遇到的问题
- L型四驱越野模型车初期磨合指南
- l3fwd 是什么_服务器DPDK l3fwd性能测试
- mysql 物理备份工具_mysql物理备份工具Xtrabackup安装配置
- 用dblink能修改_【学习笔记】通过修改基表(link$)让非public dblink变为public