G
Guoqi Zheng
Dear Sir,
I need to access the datasource of a repeater control.
I used CType(e.Item.DataItem, DataRowView), but obviously it does not work.
Can some one tell me what I did wrong? See my code example below!
Sub MainItem_Created(ByVal sender As Object, ByVal e As
RepeaterItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim But As LinkButton = CType(e.Item.FindControl("ButShow"), LinkButton)
Dim sRow As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim strName As String = sRow("MyName")
But.Text = strName
End If
End Sub
I need to access the datasource of a repeater control.
I used CType(e.Item.DataItem, DataRowView), but obviously it does not work.
Can some one tell me what I did wrong? See my code example below!
Sub MainItem_Created(ByVal sender As Object, ByVal e As
RepeaterItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim But As LinkButton = CType(e.Item.FindControl("ButShow"), LinkButton)
Dim sRow As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim strName As String = sRow("MyName")
But.Text = strName
End If
End Sub