转发器中的RadioButtonList存在于另一个转发器中 [英] RadioButtonList in Repeater present within another Repeater
本文介绍了转发器中的RadioButtonList存在于另一个转发器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用中继器填充所有问题,并且在此中继器中是另一个中继器,其中填充了每个问题的选择.
I am using a repeater to populate all the Questions and within this repeater is another repeater which populates the Choices for each Question.
代码是
<asp:Repeater ID="RepeaterQA" runat="server" DataSourceID="SqlDataSourceQ"
OnItemDataBound="RepeaterQA_ItemDataBound">
<ItemTemplate>
<table>
<tbody>
<tr>
<td>
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("QuestionID") %>' />
<asp:Label ID="Label1" runat="server" Font-Bold="true" Text='<%#Eval("Question") %>' /><br />
<asp:Repeater ID="RepeaterA" runat="server" OnItemDataBound="RepeaterA_ItemDataBound">
<ItemTemplate>
<asp:HiddenField ID="hfQuestionTypeID" runat="server" Value='<%#Eval("QuestionType") %>' />
<asp:RadioButtonList ID="RadioButtonList1" RepeatColumns="1" runat="server" Visible="false" />
<asp:CheckBox ID="CheckAnswers" Visible="false" Text='<%#Eval("Answer") %>' runat="server" /><br />
<textarea cols="2" id="txtOpenResponse" runat="server" rows="4" style="width: 400px"></textarea>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtOpenResponse" ErrorMessage="" SetFocusOnError="True"
ValidationGroup="OpenResponse" Display="Dynamic"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</tbody>
</table>
</ItemTemplate>
</asp:Repeater>
当我为每个答案使用RadioButtonList时,其生成的RadioButtonList,
When Ii am using RadioButtonList for every answer its generating RadioButtonList,
例如,如果我对一个问题有五个答案,则会生成25个单选按钮....
For example if i have five answers for a Question, 25 Radio buttons are generated....
<input type="hidden" id="gwProxy" /><input type="hidden" id="jsProxy" önclick="jsCall();" />
<input type="hidden" id="gwProxy"></input><input type="hidden" id="jsProxy" önclick="jsCall();" />
推荐答案
您还应该将问题直接标记为ASP.NET.
哦,我明白了.您将不得不用单选按钮列表替换内部的中继器,因为它本身就是一个数据绑定控件,或者,如果您需要用它来存储内容,则只需要在每个中继器中放置一个单选按钮即可.
You should also tag your question as ASP.NET, as it is.
Oh, I see what the question is. You will have to either replace your inner repeater with a radiobuttonlist, as that is, in itself, a databound control, or you''ll need to place just a radiobutton inside each repeater, if you need that to stle the content.
这篇关于转发器中的RadioButtonList存在于另一个转发器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文