access repeater datarowview

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top