Good afternoon, I'm currently working in a control that looks like this:
Now my ultimate goal is that if some criteria is met, I want to set the Panel.Visible = False. I have the code working, that will find the Gridview and based on it's criteria set the Panel visible to false... however when the page is rendered it is still set to true. I know the code to set it to false is working because if I do:
Protected Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound
Dim Dl3 As DataList = CType(e.Item.FindControl("Datalist3"), DataList)
If Dl3.Items.Count <> 0 Then
Dim gv30 As GridView = CType(FindC("GridView30", DataList1.Controls), GridView)
Response.Write(gv30.Rows.Count.ToString() & ",")
If gv30.Rows.Count > 0 Then
Dim pnl1 As Panel = CType(FindC("pnlDStrut", DataList1.Controls), Panel)
pnl1.Visible = False
Response.Write(pnl1.Visible.ToString()) <-------DISPLAYS "False" at the top of the page.----->
However, the panel is still visible - I'm assuming since it's default property is true - that is somehow overriding what I set it to. Whatever the default mode is set to, that's how it's rendered on the page when it's done.
(FindC is a function that finds nested control, btw)
ANY ideas at all on how to fix this and have my code be the final say in it?