Click here to Skip to main content
15,997,744 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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>
Posted
Updated 10-Dec-18 2:00am
Comments
F-ES Sitecore 7-Dec-18 11:33am    
GridView renders as a table itself, you don't need your own table mark-up, just use columns and rows and it'll render as a table.
AhmedHosny96 7-Dec-18 11:43am    
even if i do not use the table mark-up its not still displaying

1 solution

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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900