I've a GridView inside a Panel that I want to hide when the child is empty because at the moment remains a fieldset
with the legend
text and nothing inside.
I've already tried to put something like Panel.Visible = GridView.Rows.Count > 0
in the Page_Load
event but it doesn't works well.
How can I obtain the result that I need?
Thank you
Some more details:
If on first load the database table is empty I don't see the fieldset
, when I add a row the Panel with the GridView doesn't appears; if on first load I have a row I can see the Panel with the GridView, when I delete the unique row anything disapears but never come back even if I insert a new row. I think that the Page_Load is not the right event.
In the end I found my problem... I've put the FormView for the insert and the GridView in different UpdatePanels, so unified all in the same UpdatePanel and used this code:
in the GridView DataBound event and it worked.
Thank you everyone.