Looping through Asp.net Repeater and obtain Data Values

when there is a case that you need to use a Asp repeater and access its data members then you should assign the value of data items within Asp Label/Literal Control. Keep in mind you can only use DataItem Method  when you are doing a DataBound/ItemCreated Event, any other event will not return the value of your items within the asp repeater.

            For Each Item As RepeaterItem In rp.Items
                Dim mfg As String = CType(Item.FindControl("mfg"), Label).Text
                Dim title As String = CType(Item.FindControl("title"), Label).Text

as you can see i looped through a repeater and then used the CType Function to get the Value of mfg Column.

Posted by:

Comments History

by: on
so in repeater we should always use control's, if we need to access the values within it. Keyword is... CType(Item.FindControl("mfg"), Label).Text Thanks

Name :  

Email :  

Comment Below