So I'm quite new to .NET
and I have a small menu with multiple buttons
(foo1, foo2... foo5).
My question is: is it better to have a panel for each button and modify the .visible
property with buttons are clicked OR should I change the Controls inside the Panel each time a menu button is clicked knowing that the different panels are quite similar?
which of those two is the best way handle the problem, hope my question is clear
That depends on the use you have in mind for these panels. For example, is the information on the panel static or it renders dynamically?
Most of the time I have independent panels because it's easier to maintain (a panel that is used for doing many different things can be messy to code and style). In few cases, I use the same panel for different purposes, most of all in situations where the content is dynamically generated, I want to re-use code and having multiple panels is not an option because that would require a high number of panels.
To hide panels I prefer "display:none;" rather than "visibility: hidden;". The former prevents non-displayed html elements to occupy space on the page, so they don't impact on how the page looks.