zoukankan      html  css  js  c++  java
  • Repeater 嵌套

    <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">

                <ItemTemplate>

                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("QuestionName") %>'></asp:Label>

                    <asp:Label ID="Label2" runat="server" Text='<%#Eval("QID") %>' Visible="false"></asp:Label><br />

                    <asp:RadioButtonList ID="RadioButtonList1" runat="server" DataTextField="AnswerName"  DataValueField="AID"></asp:RadioButtonList>

                </ItemTemplate>

    </asp:Repeater>

     protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)

            {

                try

                {

                    //找到里面的Repeater

                    RadioButtonList RadioButtonList1 = (RadioButtonList)e.Item.FindControl("RadioButtonList1");

                    //获取Repeater绑定的数据项 

                    string QID = DataBinder.Eval(e.Item.DataItem, "QID").ToString();

                    RadioButtonList1.DataSource = dal.GetAnswerByQid(QID);

                    RadioButtonList1.DataBind();

                }

                catch { }

            }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)

      {

       for (int i = 0; i < Repeater1.Items.Count; i++)

      {

            Label lb = Repeater1.Items[i].FindControl("Label2") as Label;

      }

    }

  • 相关阅读:
    带有数字的表达式
    不使用data-ng-app指令的表达式
    简单的表达式
    第一个AngularJS控制器
    第一个AngularJS指令
    第一个AngularJS表达式实例
    HTML5<fieldset>标签
    AngularJS 包含
    [python][odlboy]设置字符串打印的颜色
    [python][oldboy]关键字参数和位置参数,默认参数,可变长参数(无名,有名)
  • 原文地址:https://www.cnblogs.com/paste/p/2118643.html
Copyright © 2011-2022 走看看