一个repeater,每个ItemTemplate中都有一个radiobuttonlist和一个按钮,我如何在按下这个按钮时对这个radiobuttonlist进行操作呢?如下:
<asp:Repeater ID="repeaterAnswer" Runat="server">
<ItemTemplate>
<TR>
<TD>
<TABLE cellSpacing="1" cellPadding="4" width="100%" align="center" bgColor="#cccccc" border="0">
<TR bgColor="#eeeded">
<TD class="normal" vAlign="top" width="86%" bgColor="#f0f8ff">
<DIV class="normal" align="left">
<DIV align="left">
<asp:Label ID="LabelRepeaterUserId" Runat="server">
<%# DataBinder.Eval(Container.DataItem,"SubmitUser")%>
</asp:Label>于
<asp:Label ID="LabelRepeaterSubmitTime" Runat="server">
<%# DataBinder.Eval(Container.DataItem,"SubmitTime")%>
</asp:Label>回答:
</DIV>
</DIV>
</TD>
</TR>
<TR bgColor="#ffffff">
<TD class="normal" vAlign="top">
<DIV align="left">
<BLOCKQUOTE><FONT face="宋体" size="2">
<asp:Label ID="LabelRepeaterTitle" Runat="server">
<%# DataBinder.Eval(Container.DataItem,"Title")%>
</asp:Label><br>
<br>
<asp:Label ID="LabelRepeaterContent" Runat="server">
<%# DataBinder.Eval(Container.DataItem,"Content")%>
</asp:Label></FONT></BLOCKQUOTE>
</DIV>
<asp:RadioButtonList ID="rblComment" Runat="server" RepeatDirection="Horizontal"  RepeatLayout="Flow" AId='<%# DataBinder.Eval(Container.DataItem,"Id")%>'></asp:RadioButtonList><asp:Button ID="btnComment" Runat="server" Text="提交"></asp:Button>
</TD> 
</TR>
</TABLE>
</TD>
</TR>
</ItemTemplate>
</asp:Repeater>

解决方案 »

  1.   

    <asp:Repeater ID="repeaterAnswer" Runat="server">
    <ItemTemplate>
    <TR>
    <TD>
    <TABLE cellSpacing="1" cellPadding="4" width="100%" align="center" bgColor="#cccccc" border="0">
    <TR bgColor="#eeeded">
    <TD class="normal" vAlign="top" width="86%" bgColor="#f0f8ff">
    <DIV class="normal" align="left">
    <DIV align="left">
    <asp:Label ID="LabelRepeaterUserId" Runat="server">
    <%# DataBinder.Eval(Container.DataItem,"SubmitUser")%>
    </asp:Label>于
    <asp:Label ID="LabelRepeaterSubmitTime" Runat="server">
    <%# DataBinder.Eval(Container.DataItem,"SubmitTime")%>
    </asp:Label>回答:
    </DIV>
    </DIV>
    </TD>
    </TR>
    <TR bgColor="#ffffff">
    <TD class="normal" vAlign="top">
    <DIV align="left">
    <BLOCKQUOTE><FONT face="宋体" size="2">
    <asp:Label ID="LabelRepeaterTitle" Runat="server">
    <%# DataBinder.Eval(Container.DataItem,"Title")%>
    </asp:Label><br>
    <br>
    <asp:Label ID="LabelRepeaterContent" Runat="server">
    <%# DataBinder.Eval(Container.DataItem,"Content")%>
    </asp:Label></FONT></BLOCKQUOTE>
    </DIV>
    <asp:RadioButtonList ID="rblComment" Runat="server" RepeatDirection="Horizontal"  RepeatLayout="Flow" AId='<%# DataBinder.Eval(Container.DataItem,"Id")%>'></asp:RadioButtonList><asp:Button ID="btnComment" Runat="server" Text="提交"></asp:Button>
    </TD> 
    </TR>
    </TABLE>
    </TD>
    </TR>
    </ItemTemplate>
    </asp:Repeater>
      

  2.   

    你给这个按钮设置下CommandName
    然后在Repeater的ItemCommand事件中处理这个CommandNmae
    然后同时用获得其他控件,譬如LABEL/TEXTBOX这样控件那样
    Dim rbl as RadioButtonList = ctype(e.item.findcontrol("xxx"),RadioButtonList)
    这样,然后自己看着操作了..