Results 1 to 2 of 2

Thread: Databinding error

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    17

    Databinding error

    Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            Dim al As ArrayList = CType(Session("AnswerList"), ArrayList)
    
            resultGrid.DataSource = al
            resultGrid.DataBind()
    
            'Save the results into the database
            Dim answers As Answer = New Answer()
    
            Dim questions As Integer
    
            questions = al.Count
            al.Add(answers)
            Dim correct As Double = 0
    
            Dim i As Integer = 0
            For i = 0 To al.Count
                Dim a As Answer = CType(al(i), Answer)
    
                If a.Result = Answer.ResultValue.Correct Then
                    correct += 1
                End If
            Next
    
            Dim score As Double = (correct / questions) * 100
            Label1.Text = score
            SqlDataSource2.Insert()
            Session.Add("DateTimeComplete", DateTime.Now)
            Session.Add("Score", score)
    End Sub
    
    
    
    Protected Sub resultGrid_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles resultGrid.SelectedIndexChanged
            SqlDataSource1.FilterExpression = "QuestionID=" & resultGrid.SelectedValue.ToString()
        End Sub
    Please help me. Thanks.
    Attached Images Attached Images  

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Databinding error

    What does the grid's markup look like?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width