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">
&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>

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以及内层调用外层数据的更多相关文章

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

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

  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. C# 中 List.Sort运用(IComparer<T>)排序用法

    /// <summary> /// 比较人物类实例大小,实现接口IComparer /// </summary> public class InternetProtocolCo ...

  2. Tomcat5内存简单优化

    tomcat版本:apache-tomcat-5.5.28 解压版tomcat 修改catalina.bat文件,在开头添加如下内容: JAVA_OPTS='-Xms1024m -Xmx2048m - ...

  3. Linux 下 CPU 使用率与机器负载的关系与区别

    原文链接:  http://blog.chinaunix.net/uid-28541347-id-4926054.html 当我们使用top命令查看系统的资源使用情况时会看到load average, ...

  4. HTTP 错误 500.19 配置文件错误 ( 0x8007000d,0x80070032)

    HTTP 错误 500.19 - Internal Server Error无法访问请求的页面,因为该页的相关配置数据无效. 详细错误信息模块 IIS Web Core 通知 未知 处理程序 尚未确定 ...

  5. iOS:if a ViewController is Visible

    from:stackoverflow The view's window property is non-nil if a view is currently visible, so check th ...

  6. Js参数值中含有单引号或双引号解决办法

    <script type="text/javascript"> function Display(LoginEmail, UserName, ID) {         ...

  7. kafka学习之-雅虎开源管理工具Kafka Manager

    http://blog.csdn.net/lizhitao/article/details/44523663

  8. 【数据分析知识点】detailed table of contents

    Exploratory Data Analysis - Detailed Table of Contents http://www.itl.nist.gov/div898/handbook/eda/e ...

  9. linux下安装软件的常用方法

    在使用Linux系统的过程中,软件包的安装是避免不了的,在Linux下,软件安装程序的种类很多,安装方法也各式各样,(舒适性自然比不上windows :-))不过我们常见的软件包有两种: 1)含有软件 ...

  10. linux(redhat)环境下,如何解压rar文件?

    需求描述: 今天一个同事发过来一个压缩文件,让传送到linux服务器上,传上去之后,发现是rar格式的 之前没有解压过,就找了一些解压方法,在此记录下. 操作过程: 1.下载rar在linux环境下的 ...