寻找合适的DataBound控件来实现问题页面

发布于 2024-11-30 22:08:49 字数 230 浏览 1 评论 0原文

我期待找到合适的 asp.net DataBound 控件 (C#) 在我的应用程序中实现。

我想创建一个考试页面,其中每页显示 10 个问题,每个问题都有一个 Label 控件和一个单选按钮控件来显示选项,要绑定到 DataBound 控件的数据可能有多行,其中每行代表每个问题。

我发现 DetailView 控件非常适合我的要求,但我无法设置页面大小。

请帮忙提供一些建议和意见,先谢谢您了。

I looking forward to find a suitable asp.net DataBound control (C#) to implement in my application.

I wanted to create a exam page where each page show 10 questions, each question got a Label control and a radiobutton control to display the choices, the data to be bind into the DataBound control might be having multiple rows where each rows represent each question.

I found that DetailView control was quite suit with my requirement but I not able to set the page size.

Please help to give some suggestion and advises, thank you in advanced.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愁以何悠 2024-12-07 22:08:50

我建议您使用 Repeater 控件,因为您可以非常轻松地自定义它的设计以满足您的需求。

这里有两个关于如何使用它的教程:

http://www.w3schools.com/aspnet/aspnet_repeater .asp

http://www.learn-asp.net/asptutorials/Repeater.aspx

更新:

Repeater 不包含分页,因此您必须添加它:

http://blog.divergencehosting.com/2009/03/25/adding-paging-repeater/

其他选项是仅使用包含分页的 GridView。

I would recommend to you to use the Repeater control since you can customize it's design very easily to suit your needs.

Here are two tutorials on how to use it:

http://www.w3schools.com/aspnet/aspnet_repeater.asp

http://www.learn-asp.net/asptutorials/Repeater.aspx

Update:

Repeater doesn't have pagination included so you would have to add it:

http://blog.divergencehosting.com/2009/03/25/adding-paging-repeater/

Other option would be to just use a GridView which has pagination included.

裂开嘴轻声笑有多痛 2024-12-07 22:08:49

我会使用 DataList 或 ListView,因为它允许您为每个项目输入一个模板。我选择这些而不是中继器的原因是因为您可以使用数据密钥,这可能会派上用场。

以下是如何实施问题列表的简单示例:

<asp:DataList ID="DataList1" runat="server" DataKeyField="QuestionID" ...>
    <ItemTemplate>
        <asp:Label ID="Label1" runat="server" Text='<%#Eval("Question")%>' />
        <asp:RadioButton ID="RadioButton1" runat="server" Text="Yes" GroupName="QuestionAnswer" ... />
        <asp:RadioButton ID="RadioButton2" runat="server" Text="No" GroupName="QuestionAnswer" ... />
    </ItemTemplate>
</asp:DataList>

I would use a DataList or a ListView, because it will allow you to enter a template for each item. The reason I would choose these over a repeater is because you can use data keys, which will probably come in handy.

Here's a simple example of how you could implement a list of questions:

<asp:DataList ID="DataList1" runat="server" DataKeyField="QuestionID" ...>
    <ItemTemplate>
        <asp:Label ID="Label1" runat="server" Text='<%#Eval("Question")%>' />
        <asp:RadioButton ID="RadioButton1" runat="server" Text="Yes" GroupName="QuestionAnswer" ... />
        <asp:RadioButton ID="RadioButton2" runat="server" Text="No" GroupName="QuestionAnswer" ... />
    </ItemTemplate>
</asp:DataList>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文