Protected Sub ContactsListView_ItemDataBound(ByVal sender As Object, _
ByVal e As ListViewItemEventArgs)
If e.Item.ItemType = ListViewItemType.DataItem Then
' Display the e-mail address in italics.
Dim EmailAddressLabel As Label = _
CType(e.Item.FindControl("EmailAddressLabel"), Label)
EmailAddressLabel.Font.Italic = True
Dim rowView As System.Data.DataRowView
rowView = CType(e.Item.DataItem, System.Data.DataRowView)
Dim currentEmailAddress As String = rowView("EmailAddress").ToString()
If currentEmailAddress = "orlando0@adventure-works.com" Then
EmailAddressLabel.Font.Bold = True
End If
End If
End Sub
As everyone has mentioned, you can loop (iterate) through each control/item within the parent control to find (findcontrol("the_control")) and get/set values.
Check out my website: http://www.TheTradeBox.com
Love collecting video games, movies and board games!
Enjoying my '11 WRX, so sexy...
mebinici
Participant
815 Points
256 Posts
Re: problem in finding control?
May 11, 2012 04:59 PM|LINK
When you bind your control (ListView), look at these:
ListView.ItemDataBound Event
ListView.ItemCreated Event
Protected Sub ContactsListView_ItemDataBound(ByVal sender As Object, _ ByVal e As ListViewItemEventArgs) If e.Item.ItemType = ListViewItemType.DataItem Then ' Display the e-mail address in italics. Dim EmailAddressLabel As Label = _ CType(e.Item.FindControl("EmailAddressLabel"), Label) EmailAddressLabel.Font.Italic = True Dim rowView As System.Data.DataRowView rowView = CType(e.Item.DataItem, System.Data.DataRowView) Dim currentEmailAddress As String = rowView("EmailAddress").ToString() If currentEmailAddress = "orlando0@adventure-works.com" Then EmailAddressLabel.Font.Bold = True End If End If End SubAs everyone has mentioned, you can loop (iterate) through each control/item within the parent control to find (findcontrol("the_control")) and get/set values.
Love collecting video games, movies and board games!
Enjoying my '11 WRX, so sexy...