I have saved the questions using AddQuestion.asp x page i have created but i don't know how to display it and calculate their score.
this is the formview i have done, but there is some error
Error!
Thanks for the help, any help would be appreciated.
this is the formview i have done, but there is some error
Code:
<asp:FormView ID="FormView1" runat="server" DataKeyNames="QuestionID" DataSourceID="SqlDataSource1"
Width="151px" AllowPaging="True">
<EditItemTemplate>
QuestionID:
<asp:Label ID="QuestionIDLabel1" runat="server" Text='<%# Eval("QuestionID") %>'>
</asp:Label><br />
Question:
<asp:TextBox ID="QuestionTextBox" runat="server" Text='<%# Bind("Question") %>'>
</asp:TextBox><br />
Choice1:
<asp:TextBox ID="Choice1TextBox" runat="server" Text='<%# Bind("Choice1") %>'>
</asp:TextBox><br />
Choice2:
<asp:TextBox ID="Choice2TextBox" runat="server" Text='<%# Bind("Choice2") %>'>
</asp:TextBox><br />
Choice3:
<asp:TextBox ID="Choice3TextBox" runat="server" Text='<%# Bind("Choice3") %>'>
</asp:TextBox><br />
Choice4:
<asp:TextBox ID="Choice4TextBox" runat="server" Text='<%# Bind("Choice4") %>'>
</asp:TextBox><br />
Answer:
<asp:TextBox ID="AnswerTextBox" runat="server" Text='<%# Bind("Answer") %>'>
</asp:TextBox><br />
ModuleID:
<asp:TextBox ID="ModuleIDTextBox" runat="server" Text='<%# Bind("ModuleID") %>'>
</asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update">
</asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
Question:
<asp:TextBox ID="QuestionTextBox" runat="server" Text='<%# Bind("Question") %>'>
</asp:TextBox><br />
Choice1:
<asp:TextBox ID="Choice1TextBox" runat="server" Text='<%# Bind("Choice1") %>'>
</asp:TextBox><br />
Choice2:
<asp:TextBox ID="Choice2TextBox" runat="server" Text='<%# Bind("Choice2") %>'>
</asp:TextBox><br />
Choice3:
<asp:TextBox ID="Choice3TextBox" runat="server" Text='<%# Bind("Choice3") %>'>
</asp:TextBox><br />
Choice4:
<asp:TextBox ID="Choice4TextBox" runat="server" Text='<%# Bind("Choice4") %>'>
</asp:TextBox><br />
Answer:
<asp:TextBox ID="AnswerTextBox" runat="server" Text='<%# Bind("Answer") %>'>
</asp:TextBox><br />
ModuleID:
<asp:TextBox ID="ModuleIDTextBox" runat="server" Text='<%# Bind("ModuleID") %>'>
</asp:TextBox><br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTemplate>
<ItemTemplate>
Question
<asp:Label ID="QuestionIDLabel" runat="server" Text='<%# Eval("QuestionID") %>'></asp:Label>:<br />
<asp:Label ID="QuestionLabel" runat="server" Text='<%# Bind("Question") %>' Height="93px" Width="416px"></asp:Label><br /><asp:RadioButton ID="RadioButton1" runat="server" Checked='<%# Bind("Choice1") %>'
Height="11px" Width="105px" />A:
<asp:Label ID="Choice1Label" runat="server" Text='<%# Bind("Choice1") %>' Width="260px"></asp:Label><br /><asp:RadioButton ID="RadioButton2" runat="server" Checked='<%# Bind("Choice2") %>'
Height="11px" Width="105px" />B:
<asp:Label ID="Choice2Label" runat="server" Text='<%# Bind("Choice2") %>' Width="263px"></asp:Label><br /><asp:RadioButton ID="RadioButton3" runat="server" Checked='<%# Bind("Choice3") %>'
Height="11px" Width="105px" />C:
<asp:Label ID="Choice3Label" runat="server" Text='<%# Bind("Choice3") %>' Width="259px"></asp:Label><br /><asp:RadioButton ID="RadioButton4" runat="server" Checked='<%# Bind("Choice4") %>'
Height="11px" Width="105px" />D:
<asp:Label ID="Choice4Label" runat="server" Text='<%# Bind("Choice4") %>' Width="255px"></asp:Label><br />
<asp:Label ID="AnswerLabel" runat="server" Text='<%# Bind("Answer") %>' Visible="False"></asp:Label><br />
<asp:Label ID="ModuleIDLabel" runat="server" Text='<%# Bind("ModuleID") %>' Visible="False"></asp:Label><br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="Edit" Visible="False"></asp:LinkButton>
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
Text="Delete" Visible="False"></asp:LinkButton>
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
Text="New" Visible="False"></asp:LinkButton>
</ItemTemplate>
</asp:FormView>
Code:
Conversion from type 'DBNull' to type 'Boolean' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'Boolean' is not valid.
Source Error:
Line 80: Question
Line 81: <asp:Label ID="QuestionIDLabel" runat="server" Text='<%# Eval("QuestionID") %>'></asp:Label>:<br />
Line 82: <asp:Label ID="QuestionLabel" runat="server" Text='<%# Bind("Question") %>' Height="93px" Width="416px"></asp:Label><br /><asp:RadioButton ID="RadioButton1" runat="server" Checked='<%# Bind("Choice1") %>'
Line 83: Height="11px" Width="105px" />A:
Line 84: <asp:Label ID="Choice1Label" runat="server" Text='<%# Bind("Choice1") %>' Width="260px"></asp:Label><br /><asp:RadioButton ID="RadioButton2" runat="server" Checked='<%# Bind("Choice2") %>'
Comment