How can I make a table auto size to content (e.g. use the minimum size sufficient to show inner controls) in ASP.NET 3.5?
I have a table that has a couple of rows. Some rows are not always required to be shown (e.g. when all the controls in that row are hidden). I want those rows to be hidden (or size = 0) and consequently the table to become smaller.
Not knowing your exact setup, it’s hard to give a specific answer to fit your need. If a table row is displayed on the page, it will take up at least one line unless you turn it off. One method would be to set the table row to runat=”server”, and then set visible=”false” in your code-behind if the controls within are not displaying.
In your code-behind: