<asp:Repeater ID="YhRp" runat="server" onitemcommand="YhRp_ItemCommand">        
                <ItemTemplate>
                            <asp:Label ID="count" runat="server" Text="0"></asp:Label>
                </ItemTemplate>
            </asp:Repeater><asp:TextBox ID="Textbox1" runat="server"></asp:TextBox>
<asp:Button ID="Button" CommandName="Button" runat="server" Text="Button" />比如说我绑定的这个lable的值是 1 2 3 4 5  2是第二行   我想怎么通过点击Button 通过Textbox的值找Repeater中这个值所在的item第几项?

解决方案 »

  1.   

    Repeater下放上一个Button,然后双击这个Button,写上以下代码:参考:
    for (int i = 0; i < rpt1.Items.Count; i++)
                        {
                            CheckBox chk1 = (CheckBox)rpt1.Items[i].FindControl("chk1");
                            if (chk1.Checked)
                            { xxxxx}}