A
Adam Knight
Hi all,
A quick question on data item availability?
See the function below. Upon clicking an button the following function is
executed.
My problem is, whenever the DataItem property is access nothing is return,
except a null exception.
Can i only use the DataItem while databind?
If so, what suggestions do you have to retrieve a db value relating to a
particular datagrid item?
Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'variable declarations
Dim blnCorrect As Boolean
Dim dgAnswerOptions As DataGrid
'iterate through data list items
For Each dlstItem As DataListItem In dlstAssessment.Items
'locate answer options datagrid control; store it in a local
variable
dgAnswerOptions =
CType(dlstItem.FindControl("dgAnswerOptions"),DataGrid)
'boolean variable indicating question has been answered correctly
blnCorrect = True
'iterate through data grid items
For Each dgItem As DataGridItem In dgAnswerOptions.Items
Try
Response.Write("Data Item: " &
dgItem.DataItem("is_correct"))
Catch
End Try
Next
Next
End Sub
Help appreciated!!
Adam
A quick question on data item availability?
See the function below. Upon clicking an button the following function is
executed.
My problem is, whenever the DataItem property is access nothing is return,
except a null exception.
Can i only use the DataItem while databind?
If so, what suggestions do you have to retrieve a db value relating to a
particular datagrid item?
Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'variable declarations
Dim blnCorrect As Boolean
Dim dgAnswerOptions As DataGrid
'iterate through data list items
For Each dlstItem As DataListItem In dlstAssessment.Items
'locate answer options datagrid control; store it in a local
variable
dgAnswerOptions =
CType(dlstItem.FindControl("dgAnswerOptions"),DataGrid)
'boolean variable indicating question has been answered correctly
blnCorrect = True
'iterate through data grid items
For Each dgItem As DataGridItem In dgAnswerOptions.Items
Try
Response.Write("Data Item: " &
dgItem.DataItem("is_correct"))
Catch
End Try
Next
Next
End Sub
Help appreciated!!
Adam