Repeater嵌套绑定Repeater以及内层调用外层数据
aspx:
- <table border="" cellpadding="" cellspacing="" style="margin-bottom: 5px" width="100%">
- <asp:Repeater runat="server" ID="rptypelist" OnItemDataBound="rptypelist_ItemDataBound">
- <ItemTemplate>
- <tr>
- <td class="fb">
- <a href="Lists.aspx?Qtid=<%#Eval("qtid") %>"><%#Eval("qtypename") %></a> <span id="askCount_15"
- class="date2">[<%#Eval("typecount")%>]</span>
- </td>
- </tr>
- <tr>
- <td>
- <div id="askTop2_15" class="ask_list">
- <asp:Repeater runat="server" ID="rpquestionlist">
- <ItemTemplate>
- <a href="Question.aspx?qid=<%#Eval("liftquestionid")%>">
- <%#Eval("questiontitle")%></a><br />
- 父级数据:<%# DataBinder.Eval(((RepeaterItem)Container.Parent.Parent).DataItem, "qtid")%>
- 父级序号:<%# ((RepeaterItem)Container.Parent.Parent).ItemIndex %>
- </ItemTemplate>
- </asp:Repeater>
- </div>
- </td>
- </tr>
- </ItemTemplate>
- </asp:Repeater>
- </table>
CS
- private void Repeater1Bind()
- {//GetQuestionTypeAndCount() 返回一个datatable
- this.rptypelist.DataSource = LiftQuestionCtr.GetQuestionTypeAndCount();
- this.rptypelist.DataBind();
- }
- protected void rptypelist_ItemDataBound(object sender, RepeaterItemEventArgs e)
- {
- //判断里层repeater处于外层repeater的哪个位置( AlternatingItemTemplate,FooterTemplate,
- //HeaderTemplate,,ItemTemplate,SeparatorTemplate)
- if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
- {
- Repeater rep = e.Item.FindControl("rpquestionlist") as Repeater;//找到里层的repeater对象
- DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项
- int typeid = Convert.ToInt32(rowv["qtid"]); //获取填充子类的id
- rep.DataSource = LiftQuestionCtr.GetSomeQuestionsByTypeid(typeid, );
- rep.DataBind();
- }
- }
Repeater嵌套绑定Repeater以及内层调用外层数据的更多相关文章
- 转:Repeater嵌套绑定Repeater以及内层调用外层数据
<table border=" style="margin-bottom: 5px" width="100%"> <asp:Repe ...
- Repeater嵌套绑定Repeater
前台Html代码 <asp:Repeater runat="server" ID="rpList" OnItemDataBound="rpLis ...
- 关于Repeater嵌套绑定的问题
前台代码: <div id="firstpane" class="menu_list"> <asp:Repeat ...
- DataList与Repeater嵌套绑定
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="home.aspx.cs&quo ...
- asp.net:repeater嵌套(常用于新闻等在首页归类显示)
using System;using System.Configuration;using System.Collections.Generic;using System.Linq;using Sys ...
- Repeater 嵌套,子级Repeater获取 父级Repeater 中的值
第一种方法,子级Repeater中绑定父级的某个字段: <%# DataBinder.Eval((Container.NamingContainer.NamingContainer as Rep ...
- Repeater嵌套Repeater并取得嵌套Repeater里面的控件
前台代码: <asp:Repeater ID="RepeaterScene" runat="server" OnItemDataBound=&quo ...
- 关于Repeater中绑定的控件不触发ItemCommand事件
今天遇到 在repeater 中使用一个button,点击button然后跳转另外一个页面. html. <asp:Repeater ID="repeater" runat= ...
- 多个不同的表合并到一个datatable中,repeater在绑定datatable
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI ...
随机推荐
- TCP三次握手建立关系
三次握手(three times handshake:three-way handshake)所谓的“三次握手”即对每次发送的数据量是怎样跟踪进行协商使数据段的 发送和接收同步,根据所接收到的数据量而 ...
- C# Http访问帮助类,支持get post请求文件下载 [
using System; using System.Collections.Generic; using System.Collections.Specialized; using System.I ...
- 浪漫程序员 HTML5爱心表白动画
我们程序员在追求爱情方面也是非常浪漫的,下面是一位同学利用自己所学的HTML5知识自制的HTML5爱心表白动画,画面非常温馨甜蜜,这样的创意很容易打动女孩,如果你是单身的程序员,也赶紧来制作自己的爱心 ...
- SpringBoot和SpringCloud配置
1.基本配置 #项目名称(访问路径) server.context-path=/manager #端口 server.port=8764 #session过期时间 server.sessionTime ...
- List&Map&Set的操作和遍历
Java的三大集合即:Set.List.Map. Set:代表无序.不可重复的集合,常用的有HashSet(哈希表实现).TreeSet(红黑树实现): List:代表有序.可以重复的集合,比较常用的 ...
- WiFidog 广告路由可修改功能更加智能化的几点看法
海蜘蛛Tomato出了mini版,这个对很多做WiFi营销的朋友来说,是一个福音,因为可以直接从FIR302B,一台30多块钱的路由直接刷成Hi-WiFi,而且界面这么漂亮 相信很多人已经对此界面OE ...
- linux中crontab实战篇
1.先安装crontab,之前的文章有介绍 2.查看 crontab -l 3.编辑 crontab -e 0 7 * * * /application/php/bin/php www.xialan. ...
- asp.net mvc maproute定义可变数量的自定义片断变量
有时候我们定义了如{controller}/{action}/{id}之类的路由规则,但是后面还可能跟上一堆可能会有可能不会有,但是路由规则是一样的,如{controller}/{action}/{i ...
- 【Spark】session 代替 SparkConf、SparkContext和SQLContext
http://www.raincent.com/content-85-7196-1.html
- MongoDB的php可视化管理工具
使用MongoDB命令查看很不方便 于是想把爬来的数据导出来,看爬来的数据是否正确 打开cmd,执行 mongoexport -d test -c blogs --csv -f title,link, ...