Reputation: 1138
I have two repeater which are nested..Means there is one repeater and inside that i have another repeater.
I want data in following format:
*Transaction Id:1xasd2*
Product1 2 500
*Transaction Id:2asd21*
Product2 1 100
Product3 2 200
So how can i achieve this?
Upvotes: 1
Views: 3481
Reputation: 747
can use:
var repeater = (Repeater)sender;
var parentItem = (RepeaterItem)repeater.NamingContainer;
<Object> parentDataItem = parentItem.DataItem as <Object>;
(parentDataItem.property)
Worked!
Upvotes: 1
Reputation: 3156
I think yr looking for:
Protected Sub rptMaster_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptMaster.ItemDataBound
Dim drv As DataRowView = e.Item.DataItem
Dim rptChild As Repeater = CType(e.Item.FindControl("rptChild"), Repeater)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
'Get TransactionID here from master repeater
Dim lblTransactionID As Label = drv("TransactionID")
'bind child repeater here
rptChild.DataSource = GetData()
rptChild.DataBind()
End If
End Sub
Upvotes: 0