/ / ASP.NetのRadioButtonListと並行してラベルを表示する-c#、css、asp.net

ASP.NetのRadioButtonListと並行してラベルを表示する - c#、css、asp.net

私はどこでクイズアプリケーションを作成していますボタンをクリックすると、RadioButtonListの各オプションの説明を表示する必要があります。説明を表示するのに最適なコントロールは何ですか?箇条書きリストを説明フィールドにバインドしようとしましたが、箇条書き間の行間がラジオボタンリスト内の行間と一致せず、面倒です。 List <>を使用しているため、DataTableでアドホックフィールドを作成して、RadiobuttonListのDataTextFieldにバインドすることはできません。

Plzは、このためのソリューションまたはロジックを提供します。

回答:

回答№1は0

このような?

<table>
<tr>
<td>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatLayout="Flow">
<asp:ListItem Text="Question 1" Value="1"></asp:ListItem>
<asp:ListItem Text="Question 2" Value="2"></asp:ListItem>
<asp:ListItem Text="Question 3" Value="3"></asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
<div style="display: none; padding-left: 25px" id="ExplanationContent">
<label>Explanation 1</label><br />
<label>Explanation 2</label><br />
<label>Explanation 3</label>
</div>
</td>
</tr>
</table>

<input id="Button1" type="button" value="button" onclick="showExplanation()" />

<script type="text/javascript">
function showExplanation() {
document.getElementById("ExplanationContent").style.display = "block";
}
</script>

説明は <label> タグを使用して、ラジオボタンのテキストと同じスタイルが設定されていることを確認します。