Best practice for conditional output in ASP.NET MVC?
Posted
by RyanW
on Stack Overflow
See other posts from Stack Overflow
or by RyanW
Published on 2010-05-14T07:26:30Z
Indexed on
2010/05/14
7:34 UTC
Read the original article
Hit count: 317
ASP.NET
|asp.net-mvc
I'm ramping up on ASP.NET MVC and looking at how I output messages in the view. What's the best way to do something like this? Helpers? Controls? Or just as is?
<% if (ViewData.ContainsKey("message") && !string.IsNullOrEmpty(ViewData["message"].ToString())) { %>
<div class="notice">
<%= ViewData["message"] %>
</div>
<% } %>
© Stack Overflow or respective owner