I've got a setup like this:
Gridview 30, 31, etc is surrounded by a Panel. I'm setting the Panels.visible = false based on the criteria in the Gridview. I have this working... sort of.
What I need help with, is it works - but it only works on the first "item" produced by the Datalist3. If Datalist3 produces 4 Items (4 sets of 3 gridviews), the 2nd 3rd and 4th set won't listen to my code. How do I loop through Detailsview3's items and do it for each one?
I've tried the following:
Protected Sub DataList3_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
Dim dl3 As DataList = CType(FindC("Datalist3", DataList1.Controls), DataList)
Dim item As DataListItem
For Each item In dl3.Items <---------------------ERROR HERE
Dim gv30 As GridView = CType(FindC("GridView30", DataList1.Controls), GridView)
If gv30.Rows.Count = 0 Then
Dim pnl1 As Panel = CType(FindC("pnlDStrut", DataList1.Controls), Panel)
pnl1.Visible = False
But it error's out on the line mentioned above, saying the object reference is not set to an object. I assume since I'm trying to access the Datalist3 in it's own ItemDataBound event, the control isn't completely rendered so it can't find it? I don't know...
Does anybody know what I'm doing wrong and how I can get it to loop through the Datalist3's items and apply the code to each item in it rather than just the first item it produces?
Thanks a ton!