日期:2014-05-18 浏览次数:20583 次
<asp:Repeater ID="rptSubjectOfSingleSelectionList" runat="server" > <HeaderTemplate> <table cellpadding="0" cellspacing="0" class="tableList" width="800"> </HeaderTemplate> <ItemTemplate> <tr > <td > <asp:HiddenField ID="hidSingleSelectionID" runat="server" Value='<%#Eval("ID") %>'></asp:HiddenField> <b> (<%#Eval("Index")%>) <%#Eval("Question") %> (<asp:TextBox ID="txtSingleSelectionAnswer" runat="server" BorderWidth="0" Width="20px" MaxLength="1"></asp:TextBox>) </b><br /> <table width="100%" class="tableList2"> <tr align="left"><td style="width:50%"><input id="CBboxA" name="CBboxA" type="radio" value="A" runat="server" />A:<%#Eval("SelectA")%></td><td><input id="CBboxB" name="CBboxB" type="radio" value="B" runat="server" />B:<%#Eval("SelectB")%></td></tr> <tr align="left"><td style="width:50%"><input id="CBboxC" name="CBboxC" type="radio" value="C" runat="server" />C:<%#Eval("SelectC")%></td><td><input id="CBboxD" name="CBboxD" type="radio" value="D" runat="server" />D:<%#Eval("SelectD")%></td></tr> </table> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater>
<%@ Page Language="C#" AutoEventWireup="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { System.Data.DataTable dataTable1 = new System.Data.DataTable(); System.Data.DataRow dr; dataTable1.Columns.Add(new System.Data.DataColumn("ID", typeof(System.Int32))); dataTable1.Columns.Add(new System.Data.DataColumn("SelectA", typeof(System.String))); dataTable1.Columns.Add(new System.Data.DataColumn("SelectB", typeof(System.String))); dataTable1.Columns.Add(new System.Data.DataColumn("SelectC", typeof(System.String))); dataTable1.Columns.Add(new System.Data.DataColumn("SelectD", typeof(System.String))); for (int i = 0; i < 8; i++) { dr = dataTable1.NewRow(); dr[0] = i*2; dr[1] = "【孟子E章】" + i.ToString(); dr[2] = "【xxxxx" + i.ToString(); dr[3] = "【yyyyyy】" + i.ToString(); dr[4] = "【测试】" + i.ToString(); dataTable1.Rows.Add(dr);