Hi,
I'm getting a "Specified cast not valid" error on running the following code; I've noted where the error pops up. Any idea why it's happening? The code is for populating a nested repeater.
Code:
Public Sub rptQuestions_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptQuestions.ItemDataBound
Dim lt As ListItemType = e.Item.ItemType
If lt = ListItemType.Item OrElse lt = ListItemType.AlternatingItem Then
Dim dv As DataRowView = CType(e.Item.DataItem, DataRowView) <--- ERROR OCCURS HERE
If Not dv Is Nothing Then
Dim nestedRepeater As Repeater = CType(e.Item.FindControl("rptAnswers"), Repeater)
If Not nestedRepeater Is Nothing Then
nestedRepeater.DataSource = dv.CreateChildView("Answers")
nestedRepeater.DataBind()
End If
End If
End If
End Sub
By the way, I'm retrieving the information from an ArrayList.
Thanks,
Jens