How do you check in ascx
if a repeater block is null/shows no values? I am displaying its content with Container.DataItem if it helps. Other actions will essentially depend on this condition. Thanks
Asked
Active
Viewed 756 times
-2
![](../../users/profiles/6232820.webp)
Halle
- 67
- 8
-
1Show us some code. – fruggiero Apr 26 '16 at 07:31
1 Answers
0
Depending on what you actually want to achieve you could check the following:
- repeater.DataSource == null
when there is no data source, then there won't be any items - repeater.Items
Filter the items for ItemType ListItemType.Item or ListItemType.AlternatingItem to see whether there are any items bound. - You can also access the repeater itself from the ItemTemplate (navigate Container.Parent and cast then) or from codebehind like here Access Parent Repeaters DataItem Property