Hi,

I have a datalist with some labels embedded inside.

When the page loads, I can see all my labels contain text. on my
datalist_onitemcommand i can even reset their text to something else. What i
can't do is GET the text from the labels i can access. Code is as follows
(no error messages)

Protected Sub test(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs )

If e.Item.ItemType = ListItemType.Item Or _

e.Item.ItemType = ListItemType.AlternatingItem Then

Dim s As String

Dim title As String

Dim loc As String

Dim titlelbl As Label

titlelbl = CType(e.Item.FindControl("MyTitle"), Label) ' Does not give me
the labels text even though the page shows text in the label

title = titlelbl.Text

'If i try something like (titlelbl.text = "Foo") here, it works as expected

End Sub



Thanks

Steve