Here is the complete code. I tried what you suggested, but no go. However, it did get the value when I binded the gridview using the datasource wizard, but this is impractical. Not flexible enough. I need the gridview to bind dynamically.
Take a look at the code:
Dim objConn As OleDbConnection
Dim cmdSelect As OleDbCommand
Dim dtrReader As OleDbDataReader
Dim ds As DataSet
Dim id As String = "'xxxxx@aol.com'"
Dim sqlstr = "SELECT ClassListID FROM Classes WHERE TeacherID=" & id
Dim connstr = "Provider=Microsoft.Jet.OleDB.4.0; Data Source=d:/Gradebook.mdb"
objConn = New OleDbConnection(connstr)
objConn.Open()
cmdSelect = New OleDbCommand(sqlstr, objConn)
dtrReader = cmdSelect.ExecuteReader()
ds = Classlist.GetDataSet(sqlstr, connstr)
dtrReader.Close()
objConn.Close()
With ddlclass2
.DataTextField = "ClassListID"
.DataSource = ds
.DataBind()
End With
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each row As GridViewRow In GridView1.Rows
Dim score As String = CType(row.FindControl("txtscores"), TextBox).Text
Next
End Sub