Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Accessing DataItems in OnItemCreated

$
0
0

I have a radPanelBar that is is bound to an SqlDataSource. Normally I would use findcontrol in the OnItemDataBound event to access the controls in the template as follows:

 

Private Sub rpbVehicles_ItemDataBound(sender As Object, e As RadPanelBarEventArgs) Handles rpbVehicles.ItemDataBound
 
       Dim imgThumb As Image = e.Item.FindControl("imgThumb")
 
End Sub

But apparently ItemDataBound is too early in the cycle to access controls as findcontrol always returns Nothing.

I can access the controls in the ItemCreated event, but how do I access the DataItems there?

I want to do something like:

Private Sub rpbVehicles_ItemCreated(sender As Object, e As RadPanelBarEventArgs) Handles rpbVehicles.ItemCreated
 
Dim vehicleID As Integer = e.Item.DataItem("ItemID")
Dim cbShow As CheckBox = e.Item.FindControl("cbShow")
cbShow.Attributes.Add("VehicleID", vehicleID.ToString)
 
End Sub

 

How do I access the DataItems?

 

Thanks

 

Charles

 


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>