2016-08-04 2 views
-3

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

Plz私にこのための解決策またはロジックを教えてください。

答えて

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>タグ内にラップされています。

+0

ありがとうございます...しかし私の場合、radiobuttonlistオプションはデータベースから取り込まれます。だから、理想的には、ラベルもコードビハインドを介してデータベースから移入する必要があります。 – Redsesame

+0

これは問題ではありません。それらの '

関連する問題