Conditional Markup in aspx

Posted by Dynde on Stack Overflow See other posts from Stack Overflow or by Dynde
Published on 2010-03-23T09:58:00Z Indexed on 2010/03/23 10:03 UTC
Read the original article Hit count: 673

Hi...

I have a ListView. If I want to base the html markup on a condition in respects to the databound item, what would be the best way to do that?

What I mean is, is there any other way then putting <% %> if/else blocks directly in the markup?

I'm aware that a really ugly way of doing it, is putting html markup in the database field, and just let the Eval() squeeze out the proper markup (I'm not doing that).

I would like to avoid putting actual <% %> C# blocks in the code as well.

Any good ideas?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about design-patterns