如何在ASP.NET中对在线考试网站进行gridview控件 [英] How to make gridview control for online examination website in ASP.NET

查看:64
本文介绍了如何在ASP.NET中对在线考试网站进行gridview控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿家伙我正在开发在线考试网站,我正在使用网格视图控件进行多项选择问题,但是它显示表而不是显示正常的问答网格视图

我要显示的内容是这样的: -

问题1:问题

单选按钮1

单选按钮2

单选按钮3

收音机按钮4



我的尝试:



< asp:GridView ID =QuestionGridviewrunat =server> 
< Columns>
< asp:TemplateField>
< ItemTemplate>
< table>
< tr>
< td>
问题
< asp:标签ID =Label1runat =serverText ='<%#Eval(Id)%>'>< / asp:Label>
 :
< asp:Label ID =Label2runat =serverText ='<%#Eval(Question)%>'>< / asp:标签>
< / td>
< / tr>
< tr>
< td>
< br />
< asp:RadioButton GroupName =ansID =RadioButton1runat =serverText ='<%#Eval(Option1)%>'/>
< br />
< asp:RadioButton GroupName =ansID =RadioButton2runat =serverText ='<%#Eval(Option2)%>'/>
< br />
< asp:RadioButton GroupName =ansID =RadioButton3runat =serverText ='<%#Eval(Option3)%>'/>
< br />
< asp:RadioButton GroupName =ID =RadioButton4runat =serverText ='<%#Eval(Option4)%>'/>


< / td>

< / tr>

< / table>
< / ItemTemplate>
< / asp:TemplateField>
< / Columns>

< / asp:GridView>

解决方案

您可能需要考虑使用 DataList Repeater 控制而不是这样做。看看这篇文章的完整示例:在4个选项中实施在线考试问题并在ASP.Net中显示测验完成答案 [ ^

hey guys i am currently developing online examination website for the multiple choice questions i am using grid view control but its displaying tables rather then displaying the normal question and answer grid view
what i want to display is like this :-
Question 1 : Question
Radio button 1
Radio button 2
Radio button 3
Radio button 4

What I have tried:

<asp:GridView ID="QuestionGridview" runat="server"  >
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <table>
                    <tr>
                        <td>
                Question
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                 :
                <asp:Label ID="Label2" runat="server" Text='<%# Eval("Question") %>'></asp:Label>
            </td>
                            </tr>
                    <tr>
                        <td>
  <br />
                        <asp:RadioButton GroupName="ans" ID="RadioButton1" runat="server" Text='<%# Eval("Option1") %>' />
                        <br />
                        <asp:RadioButton GroupName="ans" ID="RadioButton2" runat="server" Text='<%# Eval("Option2") %>' />
                        <br />
                        <asp:RadioButton GroupName="ans" ID="RadioButton3" runat="server" Text='<%# Eval("Option3") %>' />
                        <br />
                        <asp:RadioButton GroupName="" ID="RadioButton4" runat="server" Text='<%# Eval("Option4") %>' />


                        </td>

                    </tr>
            
            </table>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>

</asp:GridView>

解决方案

You may want to consider using DataList or Repeater control instead to do that. Take a look at this post for a complete example: Implement online exam question with 4 options and display answers on quiz completion in ASP.Net[^]


这篇关于如何在ASP.NET中对在线考试网站进行gridview控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆