i am trying to make the control not visable through the css but still the control is been shown.
i tried doing like this
html1.Visible = false;
but this creates an gap in the menu where is been used
HtmlAnchor html1 = (HtmlAnchor)holder.FindControl("lblA1");
html1.Attributes.Add("class", "display:none");
i want to hide the control and do not want to display the gap there how can we achive this. any help on this would be great
You just need to use style
instead of class
:
html1.Attributes.Add("style", "display:none");
You may also consider the option of making a CSS style like:
.hidden
{
display:none;
}
And then apply it via 'class':
html1.Attributes.Add("class", "hidden");
If you want to add more than one property in style
element in that case use Style
property instead of Attributes
property like this example....
HtmlAnchor html1 = (HtmlAnchor)Page.FindControl("lblA1");
html1.Style.Add("display", "none");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With