为每个问题答案制作小组? [英] Make Group For each Question Answer ?

查看:75
本文介绍了为每个问题答案制作小组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有nasted转发器显示问题和答案(主要转发器重复问题和内部一个转发器答案每个问题)我想做1只答案可选择我试过

i have nasted repeater which display Questions And Answer ( main Repeater Repeate Questions And Inner one Repeater Answer For Each Questions ) i wanna to make 1 Answer Only Selectable i tried

GroupName='<%# Eval("ExamQuestionAnswerId")%>'



并试过其他唯一身份证但是没有办法任何建议请?




and tried Other Unique Id's but No way Any Suggesstion Please ?

<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound" OnItemCommand="Repeater1_ItemCommand">
    <ItemTemplate>
        <div class="text-left" >
            

                <div>
                    
                        <li>
                             <div id="outer" style="background-color: lightblue">  <%# Eval("QuetionText")%>           (Question Level <%# Eval("QuetionLevel")%>)           <asp:LinkButton ID="LinkButton1" CommandName="DeleteQuestion" CommandArgument=<%# Eval("QuestionID") %> runat="server">Delet This Questions</asp:LinkButton></div>
                           <br />

                        </li>
                        <div>

                        <asp:Repeater ID="Repeater2" runat="server">
                            <ItemTemplate>
                                <li>

                                <div >
                                     <asp:RadioButton ID="RadioButton1" runat="server"  Text ='<%# Eval("ExamQuestionAnswerText")%>'  GroupName='<%# Eval("ExamQuestionAnswerId")%>' ></asp:RadioButton>
                                 <asp:HiddenField ID="HiddenField1" runat="server" Value ='<%# Eval("ExamQuestionAnswerIsRight")%>'></asp:HiddenField>

                                </div>
                                    </li>
                            </ItemTemplate>
                            <FooterTemplate >

                            </FooterTemplate>
                        </asp:Repeater>
                            </div>
                    
                </div>


            
        </div>
    </ItemTemplate>

</asp:Repeater>

推荐答案

这似乎是< a href =http://support.microsoft.com/kb/316495> BUG:Radio Buttons Are在Repeater Server Control中使用时不互斥 [ ^ ]

幸运代码项目文章有解决方案

如何分组RadioButtons [ ^ ]

和其他一些解决方案可能有所帮助:

ASP.NET RadioButton弄乱名称(组名) [ ^ ]

Radio Buttons不是互相排斥的用于Repeater(或ListView) [ ^ ]
This seems to be a BUG: Radio Buttons Are Not Mutually Exclusive When Used in a Repeater Server Control[^]
fortunately Code project article having solution
How to group RadioButtons[^]
and few other solution may help :
ASP.NET RadioButton messing with the name (groupname)[^]
Radio Buttons Are Not Mutually Exclusive When Used in a Repeater (or ListView)[^]


尝试使用RadioButtonList ...

Try using RadioButtonList...
<asp:radiobuttonlist id="RadioButtonList1" runat="server" xmlns:asp="#unknown">
  <asp:repeater id="Repeater2" runat="server">
    <itemtemplate>
      <asp:listitem><%# Eval("ExamQuestionAnswerText")%></asp:listitem>
    </itemtemplate>
  </asp:repeater>
</asp:radiobuttonlist>


这篇关于为每个问题答案制作小组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆