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;

      }

    }

  • 相关阅读:
    读取IIS用户名和密码VBS代码
    sqltools最新增强版
    网站后台备份自动备份成ASA格式却并不表示拿Shell方法
    Google Hack 最新版
    FZU 2105 Digits Count(AC)
    ZOJ 1387 Decoding Morse Sequences
    ZOJ 1391 Horizontally Visible Segments
    codeforces Round #184 Div.2 B Continued Fractions
    FZU 2105 Digits Count(WA)
    POJ 2828 Buy Tickets
  • 原文地址:https://www.cnblogs.com/paste/p/2118643.html
Copyright © 2011-2022 走看看