B
Byron
'm tryin to create a quiz management system for a skool project but i'm havin a problem automatically gradin. heres a screenshot for wats happening, wich is not wat shud hapen. as u can see its marking correct answers as wrong.
http://www.fiwizone.com/alex/byron/pics/project.jpg
heres the code 4 when u press finish.
Protected Sub finButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles finButton.Click
Dim right As Integer = 0, wrong As Integer = 0
For Each item As DataListItem In DataList1.Items
Dim dv As System.Data.DataView
Dim tfRadioButtonList As RadioButtonList = CType(item.FindControl("tfRadioButtonList"), RadioButtonList)
Dim QuestionIDHiddenField As HiddenField = CType(item.FindControl("QuestionIDHiddenField"), HiddenField)
Dim AnsHiddenField As HiddenField = CType(item.FindControl("AnsHiddenField"), HiddenField)
Dim wrongPanel As Panel = CType(item.FindControl("wrongPanel"), Panel)
Dim correctPanel As Panel = CType(item.FindControl("correctPanel"), Panel)
CType(item.FindControl("fbPanel"), Panel).Enabled = False
CType(item.FindControl("lsPanel"), Panel).Enabled = False
CType(item.FindControl("mcPanel"), Panel).Enabled = False
CType(item.FindControl("tfPanel"), Panel).Enabled = False
Select Case QuestionIDHiddenField.Value.ToString.Substring(0, 2)
Case "FB"
Case "MC"
Case "LS"
Case "TF"
Select Case tfRadioButtonList.SelectedValue.ToString = AnsHiddenField.Value.ToString
Case True
correctPanel.Visible = True
wrongPanel.Visible = False
right += 1
Case False
wrongLabel.Text = "Your Answer: " + tfRadioButtonList.SelectedValue.ToString + " Correct Answer: " + AnsHiddenField.Value.ToString
wrongPanel.Visible = True
correctPanel.Visible = False
wrong += 1
End Select
End Select
Next
summaryLabel.Text = "Right: " & right & ". " & "Wrong: " & wrong
summaryLabel.Visible = True
End Sub
__
Newsgroups brought to you courtesy of www.dotnetjohn.com
http://www.fiwizone.com/alex/byron/pics/project.jpg
heres the code 4 when u press finish.
Protected Sub finButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles finButton.Click
Dim right As Integer = 0, wrong As Integer = 0
For Each item As DataListItem In DataList1.Items
Dim dv As System.Data.DataView
Dim tfRadioButtonList As RadioButtonList = CType(item.FindControl("tfRadioButtonList"), RadioButtonList)
Dim QuestionIDHiddenField As HiddenField = CType(item.FindControl("QuestionIDHiddenField"), HiddenField)
Dim AnsHiddenField As HiddenField = CType(item.FindControl("AnsHiddenField"), HiddenField)
Dim wrongPanel As Panel = CType(item.FindControl("wrongPanel"), Panel)
Dim correctPanel As Panel = CType(item.FindControl("correctPanel"), Panel)
CType(item.FindControl("fbPanel"), Panel).Enabled = False
CType(item.FindControl("lsPanel"), Panel).Enabled = False
CType(item.FindControl("mcPanel"), Panel).Enabled = False
CType(item.FindControl("tfPanel"), Panel).Enabled = False
Select Case QuestionIDHiddenField.Value.ToString.Substring(0, 2)
Case "FB"
Case "MC"
Case "LS"
Case "TF"
Select Case tfRadioButtonList.SelectedValue.ToString = AnsHiddenField.Value.ToString
Case True
correctPanel.Visible = True
wrongPanel.Visible = False
right += 1
Case False
wrongLabel.Text = "Your Answer: " + tfRadioButtonList.SelectedValue.ToString + " Correct Answer: " + AnsHiddenField.Value.ToString
wrongPanel.Visible = True
correctPanel.Visible = False
wrong += 1
End Select
End Select
Next
summaryLabel.Text = "Right: " & right & ". " & "Wrong: " & wrong
summaryLabel.Visible = True
End Sub
__
Newsgroups brought to you courtesy of www.dotnetjohn.com