<table border="" cellpadding="" cellspacing="" style="margin-bottom: 5px" width="100%">
<asp:Repeater runat="server" ID="rptypelist" OnItemDataBound="rptypelist_ItemDataBound">
<ItemTemplate>
<tr>
<td class="fb">
&nbsp;&nbsp;<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>
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以及内层调用外层数据的更多相关文章

  1. Repeater嵌套绑定Repeater以及内层调用外层数据

    aspx: <table border=" style="margin-bottom: 5px" width="100%"> <as ...

  2. Repeater嵌套绑定Repeater

    前台Html代码 <asp:Repeater runat="server" ID="rpList" OnItemDataBound="rpLis ...

  3. 关于Repeater嵌套绑定的问题

    前台代码: <div id="firstpane" class="menu_list">                <asp:Repeat ...

  4. DataList与Repeater嵌套绑定

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="home.aspx.cs&quo ...

  5. asp.net:repeater嵌套(常用于新闻等在首页归类显示)

    using System;using System.Configuration;using System.Collections.Generic;using System.Linq;using Sys ...

  6. Repeater 嵌套,子级Repeater获取 父级Repeater 中的值

    第一种方法,子级Repeater中绑定父级的某个字段: <%# DataBinder.Eval((Container.NamingContainer.NamingContainer as Rep ...

  7. Repeater嵌套Repeater并取得嵌套Repeater里面的控件

    前台代码:    <asp:Repeater ID="RepeaterScene" runat="server" OnItemDataBound=&quo ...

  8. 关于Repeater中绑定的控件不触发ItemCommand事件

    今天遇到 在repeater 中使用一个button,点击button然后跳转另外一个页面. html. <asp:Repeater ID="repeater" runat= ...

  9. 多个不同的表合并到一个datatable中,repeater在绑定datatable

    using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI ...

随机推荐

  1. Objective-C:Foundation框架-常用类-NSValue

    NSNumber是NSValue的子类,前者只能包装数字,后者可以包装任意值.NSArray.NSDictionary只能存储OC对象,不能存储结构体.因此,如果想要在NSArray.NSDictio ...

  2. @media用法。

    @media版本:CSS2  兼容性:IE5+   语法:    @media  sMedia { sRules }    说明:    sMedia :  指定设备名称.请参阅附录:设备类型  sR ...

  3. ecshop数据库取数据

    取出所有数据: test_getAll(); function test_getAll() { global $db; $sql = "SELECT user_id, user_name, ...

  4. POJ 1258 最小生成树

    23333333333 完全是道水题.因为是偶自己读懂自己做出来的..T_T.prim的模板题水过. DESCRIPTION:John竞选的时候许诺会给村子连网.现在给你任意两个村子之间的距离.让你求 ...

  5. linux 下crontabs使用

    安装crontab:[root@CentOS ~]# yum install vixie-cron[root@CentOS ~]# yum install crontabs说明:vixie-cron软 ...

  6. Swift - 自动布局库SnapKit的使用详解1(配置、使用方法、样例)

    为了适应各种屏幕尺寸,iOS 6后引入了自动布局(Auto Layout)的概念,通过使用各种 Constraint(约束)来实现页面自适应弹性布局. 在 StoryBoard 中使用约束实现自动布局 ...

  7. 使用BroadcastReceiver实现开机自动运行的Service

    为了让Service随应用系统启动自动运行,可以让BroadcastReceiver监听Action为ACTION_BOOT_COMPLETED常量的Intent,然后在BroadcastReceiv ...

  8. C# 定时器事件(设置时间间隔,间歇性执行某一函数,控制台程序)

    定时器事件代码 static void Main(string[] args) { Method(); #region 定时器事件 Timer aTimer = new Timer(); aTimer ...

  9. CNAPS Code 查询(招商银行)

    招商银行的妹子实在太傻了,根本不知道什么是CNAPS Code.联行号,完全答非所问. 最后还是自己搞定了,如图: 最后再看看招行人员的英语水平,真是不知道什么是东西:

  10. 用PDB库调试Python程序

    Python自带的pdb库,发现用pdb来调试程序还是很方便的,当然了,什么远程调试,多线程之类,pdb是搞不定的. 用pdb调试有多种方式可选: 1. 命令行启动目标程序,加上-m参数,这样调用my ...