I have a literal in my master page and in the code behind, sometimes I populate it with data and sometimes not. The literal is in a div so that I can access its value in javascript. The mark-up looks like this:
<div id="Literal1"><asp:literal .... ID="TheLiteral1" /></div>
How can I rewrite this so that if I don’t populate the literal, I don’t render the div that contains the literal.
Thanks.
Just remove the
diventirely and populate theLiteralcontrol with it when needed.In the markup (see no
div):In code behind: