嵌套repeater

原创 2007年10月09日 16:33:00

.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="examineMain.aspx.cs" Inherits="examineMain" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
            <HeaderTemplate>
                <table>
            </HeaderTemplate>
           
            <ItemTemplate>
                <tr>
                    <td>
                        <asp:Label ID="ID" runat="server"></asp:Label>:
                        <asp:Label ID="QUESTION" runat="server"></asp:Label>
                    </td>
                </tr>   
                        <asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                      
                                        <asp:RadioButton ID="radBox_Option" runat="server" GroupName="option"/>
                                        <asp:RadioButtonList ID="RadioButtonList1" runat="server">
                                        </asp:RadioButtonList><asp:CheckBox ID="ChkBox_Option" runat="server" />
                                     </td>
                                </tr>   
                            </ItemTemplate>
                        </asp:Repeater>
            </ItemTemplate>
           
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
   
    </div>
    </form>
</body>
</html>

.cs

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class examineMain : System.Web.UI.Page
{
    protected int flag;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            flag = 0;
            testSystem.DAL.DAQuestion dq = new testSystem.DAL.DAQuestion();
            DataSet ds = dq.getQuestion();
            Repeater1.DataSource = ds.Tables["question"];
            Repeater1.DataBind();           
            //Page.DataBind();
        }
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
        {
                Label lab = (Label)e.Item.FindControl("ID");
                lab.Text = ((DataRowView)e.Item.DataItem).Row["ID"].ToString();
                lab = (Label)e.Item.FindControl("QUESTION");
                lab.Text = ((DataRowView)e.Item.DataItem).Row["QUESTION"].ToString();
                flag = Convert.ToInt32(((DataRowView)e.Item.DataItem).Row["type"]);


                DataRowView drv = (DataRowView)e.Item.DataItem;
                DataView dv = drv.CreateChildView("relationQuestionToAnswer");
                Repeater r = (Repeater)e.Item.FindControl("Repeater2");
                r.DataSource = dv;
                r.DataBind();

        }
    }
 
   
    protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            RadioButton rb = (RadioButton)e.Item.FindControl("radBox_Option");
            rb.Text = ((DataRowView)e.Item.DataItem).Row["answerOption"].ToString();
            CheckBox cb = (CheckBox)e.Item.FindControl("ChkBox_Option");
            cb.Text = ((DataRowView)e.Item.DataItem).Row["answerOption"].ToString();

            if (flag==0)
            {
                rb.Visible = true;
                cb.Visible = false;
            }
            else
            {
                rb.Visible = false;
                cb.Visible = true;

            }
        }
    }
}
 

Android触摸事件传递机制及viewpager嵌套fragment冲突处理

本课程讲要对安卓中的触摸事件分发机制理论,并结合开发中常出现的触摸冲突做讲解
  • 2016年11月08日 14:00

repeater嵌套repeater嵌套

  • 2010年10月21日 14:21
  • 9KB
  • 下载

asp.net(C#)中Repeater嵌套绑定Repeater

Repeater嵌套Repeater的结构:一般写过的都能看懂吧 private void RpTypeBind() { //GetQuestionTypeAnd...
  • smartsmile2012
  • smartsmile2012
  • 2012-11-30 16:55:16
  • 9832

Repeater嵌套内层Repeater绑定ItemCommand事件

Aspx:                                 删除             >                                 ...
  • huangwei999111
  • huangwei999111
  • 2015-11-13 09:21:28
  • 1045

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

1、Container英文就是容器的意思,并且在我们程序中也确实就是!那么这个Container在我们的显示数据用的(GridView,Repeater,DataList等等)这些里面又是一个什么现象...
  • yelin042
  • yelin042
  • 2017-01-13 09:54:17
  • 1564

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

"0" cellpadding="0" cellspacing="0" style="margin-bottom: 5px" width="100%">     "server" ID="rptyp...
  • yelin042
  • yelin042
  • 2016-12-23 17:14:36
  • 400

Repeater控件的嵌套使用

Repeater控件专门用于精确内容的显示,它也是基于模板的方式,不过它不会自动生成任何用于布局的代码。Repeater控件甚至没有默认的外观,它完全是通过模板控制。而却也只能通过源代码视图进行模板的...
  • pan_junbiao
  • pan_junbiao
  • 2012-04-15 15:18:54
  • 4792

asp.net中Repeater中嵌套Repeater来显示跟外层Repeater数据相关的其他信息

在实际开发中,比如在统一权限管理系统中,我们预先定义了一些列角色,我们点击每一个角色,进入一个应用系统列表,我们要知道每个应用系统中,该角色已经拥有多少菜单访问权限,我们就可以通过Repeater中嵌...
  • taomanman
  • taomanman
  • 2015-07-03 16:38:23
  • 1947

Asp.Net Repeater的两层嵌套以及遍历取值的简单实现(checkbox)

第一种嵌套方式:
  • qq_31971935
  • qq_31971935
  • 2016-03-29 17:51:51
  • 880

[Asp.Net]Repeater嵌套使用及按钮事件处理

前台页面部分:                                   '>           ...
  • david_520042
  • david_520042
  • 2011-08-18 09:00:51
  • 1435
收藏助手
不良信息举报
您举报文章:嵌套repeater
举报原因:
原因补充:

(最多只允许输入30个字)