Find Control in a DataList..Easier Way?!
Is there an easier way to take control of a control in a DataList without doing the FindControl method?
Code:
Dim myDataListItem As DataListItem
For Each myDataListItem In DataList1.Items
If TypeOf myDataListItem Is Label Then
Dim lblText As Label = myDataListItem.FindControl("lblText")
lblText.Style.Item("left") = 0
Dim lblTitle As Label = myDataListItem.FindControl("lblTitle")
lblTitle.Style.Item("left") = 0
Else
Dim imgMain As Object = myDataListItem.FindControl("imgMain")
imgMain.Visible = False
End If
Next