<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
AllowPaging="True" PageSize="4"
DataKeyNames="questionCode"
EnableSortingAndPagingCallbacks="True" Width="780px"
onpageindexchanging="GridView1_PageIndexChanging">
<PagerSettings FirstPageText="首页" LastPageText="尾页"
Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table>
<tr>
<td align=left>
<asp:HiddenField ID="hditem" runat="server"
Value='<%# Eval("questionCode") %>' />
<asp:Label ID="Label1" runat="server" Text='<%# Eval("contents") %>'></asp:Label>
</td>
</tr>
<tr>
<td align=left>
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
DataSourceID="getAnsDS" DataTextField="ansContents"
DataValueField="ansCode" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
</asp:RadioButtonList>
<asp:SqlDataSource ID="getAnsDS" runat="server"
ConnectionString="<%$ ConnectionStrings:HST_KSConnectionString %>"
SelectCommand="GetAns" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="hditem" Name="questionCode"
PropertyName="Value" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
GridView绑定试题及答案
最新推荐文章于 2021-05-26 08:15:37 发布