Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Invisible Label from taking up space

Tags:

asp.net

Is there a way to stop a label control that is not visible from taking up space on a form?

like image 969
Ronald McDonald Avatar asked Nov 02 '25 13:11

Ronald McDonald


2 Answers

server side:

label.Attributes["style"] = "display:none";

or

label.Visible = false;

or, client-side (css):

#label-id { display: none; }

Set it's visibility to hidden through CSS. Or set it through the code behind to false. From the code behind a false setting should cause it to not be rendered at all.

Optionally, replace the label with a literal control and only emit something to it when you need to.

like image 22
NotMe Avatar answered Nov 05 '25 03:11

NotMe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!