页面控件解析
页面:
<div id="div_Qst" runat="server">
</div>
<div>
<table width='100%'><tr><td style='width:5%;'>1、</td><td>题目1</td></tr><tr><td></td><td><asp:RadioButton ID='rbtn_A1' runat='server' Text='选项A' /><asp:RadioButton ID='rbtn_B1' runat='server' Text='选项B' /><asp:RadioButton ID='rbtn_C1' runat='server' Text='选项C' /><asp:RadioButton ID='rbtn_D1' runat='server' Text='选项D' /></td></tr></table>
</div>
代码动态生成:
qstList += "<table width='100%'><tr><td style='width:5%;'>" + (i + 1)
+ "、</td><td>题目" + (i + 1) + "</td></tr><tr><td></td><td>"
+ "<asp:RadioButton ID='rbtn_A" + (i + 1) + "' runat='server' Text='选项A' />"
+ "<asp:RadioButton ID='rbtn_B" + (i + 1) + "' runat='server' Text='选项B' />"
+ "<asp:RadioButton ID='rbtn_C" + (i + 1) + "' runat='server' Text='选项C' />"
+ "<asp:RadioButton ID='rbtn_D" + (i + 1) + "' runat='server' Text='选项D' />"
+ "</td></tr></table>";
最终显示的结果:
显示的页面的源代码:
<div id="div_Qst"><table width='100%'><tr><td style='width:5%;'>1、</td><td>题目1</td></tr><tr><td></td><td><asp:RadioButton ID='rbtn_A1' runat='server' Text='选项A' /><asp:RadioButton ID='rbtn_B1' runat='server' Text='选项B' /><asp:RadioButton ID='rbtn_C1' runat='server' Text='选项C' /><asp:RadioButton ID='rbtn_D1' runat='server' Text='选项D' /></td></tr></table></div>
<div>
<table width='100%'><tr><td style='width:5%;'>1、</td><td>题目1</td></tr><tr><td></td><td><input id="rbtn_A1" type="radio" name="rbtn_A1" value="rbtn_A1" /><label for="rbtn_A1">选项A</label><input id="rbtn_B1" type="radio" name="rbtn_B1" value="rbtn_B1" /><label for="rbtn_B1">选项B</label><input id="rbtn_C1" type="radio" name="rbtn_C1" value="rbtn_C1" /><label for="rbtn_C1">选项C</label><input id="rbtn_D1" type="radio" name="rbtn_D1" value="rbtn_D1" /><label for="rbtn_D1">选项D</label></td>&