Wednesday, 12 June 2013

Hide a nested repeater with no items

If you want to hide a nested repeater, its quite simple really and useful when you have several repeaters with nested data and the same id. Just be aware that this may need some tinkering around with multiple repeaters. Add the itemdatabound event and use something along the following lines: protected void YourRepeater_ItemDataBound(object sender, EventArgs e) { Repeater repeater = sender as Repeater; if (repeater.Items.Count > 0) repeater.Visible = true; } Note: Make sure your nested repeated has visible=false as you dont want it to show if there are no items.

No comments: