Conditionally excluding a block of html in ASP.NET WebForms

  ASP.NET Snippets

Some people object to the following method but its one that no one has answered with and I feel that it should be shown as an option. It can be handy when used properly.

<label>This will not be shown if the ShowLabel property evaluates false</label><%}%>

To make this work you would have a public or protected property on your page called ShowLabel which returns a boolean.

(Visited 7 times, 1 visits today)