以下是一个查看用户答题记录的页面的html代码,我想要的效果是这样的。如图:
(不知道这个图可不可以显示)<br />可是下面的代码得到的效果却是如图:
内容重复出现了。分析造成这个现象的原因可能是repeater1依次遍历了两个表。所以。。
不知道怎么处理才能消除这个现象?请各位老大给帮忙看看,用个什么办法来达到小弟要的效果?在线等<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AnswerDetails.aspx.cs" Inherits="test" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>答题页</title>
</head>
<body style="font-size:12px; text-align:left;">
<form id="form1" runat="server">
<div style="text-align: left">
请答题: <br />
<div style="width:80%; margin-left:auto; margin-right:auto; ">
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="AccessDataSource1"
>
<ItemTemplate>
题号:<asp:Label ID="lbl_id" runat="server" Text='<%#Eval("id") %>'></asp:Label>
分值:<%#Eval("score") %><br/>
问题:<%#Eval("question") %><br/>
备注:<%#Eval("other") %><br/><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="a" />
A:<%# Eval("A") %><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="b" />
B:<%# DataBinder.Eval(Container.DataItem,"B") %><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="c" />
C:<%# DataBinder.Eval(Container.DataItem,"C") %><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="d" />
D:<%# DataBinder.Eval(Container.DataItem,"D") %><br /><br />
标准答案:<%#Eval("rightanswer") %><br />
您的答案:<%#Eval("answer") %>
<br />
<br /><br /> <hr />
</ItemTemplate>
</asp:Repeater>
<br />
</div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/examSys.mdb"
SelectCommand="SELECT [questions].[id], [question], [a], [b], [c], [d], [score], [other],[rightanswer],[answer] FROM [questions],[stuanswer]">
</asp:AccessDataSource>
</div>
</form>
</body>
</html>
(不知道这个图可不可以显示)<br />可是下面的代码得到的效果却是如图:
内容重复出现了。分析造成这个现象的原因可能是repeater1依次遍历了两个表。所以。。
不知道怎么处理才能消除这个现象?请各位老大给帮忙看看,用个什么办法来达到小弟要的效果?在线等<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AnswerDetails.aspx.cs" Inherits="test" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>答题页</title>
</head>
<body style="font-size:12px; text-align:left;">
<form id="form1" runat="server">
<div style="text-align: left">
请答题: <br />
<div style="width:80%; margin-left:auto; margin-right:auto; ">
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="AccessDataSource1"
>
<ItemTemplate>
题号:<asp:Label ID="lbl_id" runat="server" Text='<%#Eval("id") %>'></asp:Label>
分值:<%#Eval("score") %><br/>
问题:<%#Eval("question") %><br/>
备注:<%#Eval("other") %><br/><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="a" />
A:<%# Eval("A") %><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="b" />
B:<%# DataBinder.Eval(Container.DataItem,"B") %><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="c" />
C:<%# DataBinder.Eval(Container.DataItem,"C") %><br />
<asp:RadioButton runat="server" GroupName="RB_answer" ID="d" />
D:<%# DataBinder.Eval(Container.DataItem,"D") %><br /><br />
标准答案:<%#Eval("rightanswer") %><br />
您的答案:<%#Eval("answer") %>
<br />
<br /><br /> <hr />
</ItemTemplate>
</asp:Repeater>
<br />
</div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/examSys.mdb"
SelectCommand="SELECT [questions].[id], [question], [a], [b], [c], [d], [score], [other],[rightanswer],[answer] FROM [questions],[stuanswer]">
</asp:AccessDataSource>
</div>
</form>
</body>
</html>
解决方案 »
- 如何动态给页面上的按钮添加点击处理事件?
- 如果使用在服务端使用动态(html端的CheckBox),我在服务器是动态加载的
- 类似百度Mp3搜索的界面,根据选择的单选按钮跳转到相应的页面
- 域用户验证
- 在C#中如何让一个exe文件只能启动一个实例,而不能启动多个实例?请各位高手指教!!
- 如何给datagrid增加单击事件?最后60分全部放完!
- http 404错误
- 运行ASP.NET的下载文件页面,出来下载提示框后下载一直处于等待状态
- 高分求助!有关动态生成控件
- 为什么会出现System.Web.UI.WebControls.TextBox”并不包含对“Value”的定义错误?
- 关于repeater控件遍历的问题,高手来帮帮小弟呀。
- 怎样在后台写代码登录网站
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/examSys.mdb"
SelectCommand="SELECT distinct [questions].[id], [question], [a], [b], [c], [d], [score], [other],[rightanswer],[answer] FROM [questions],[stuanswer]">
</asp:AccessDataSource>