View Single Post
  #34 (permalink)  
Old June 16th, 2010, 09:05 PM
fourpastmidnight fourpastmidnight is offline
Registered User
Join Date: May 2010
Location: Douglassville, PA
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to fourpastmidnight Send a message via MSN to fourpastmidnight Send a message via Yahoo to fourpastmidnight
Cool HtmlHelper.If


The HtmlHelper.If method is not (to my knowledge) a standard .NET Base Class Library class. IIRC, this method is in one of the ManagedFusion.Web.*.dll files that came with the source code for the book (and which IIRC is freely downloadable and usable in your own projects). If it's not in ManagedFusion, it's in one of the other 3rd Party libraries.

I hope from what I've posted you can find this method.

Even if you can't, you don't need it. That method is just a nice way of doing If/Else constructs without all the "Classic ASP"-looking spaghetti code; but don't get me wrong, in the context of ASP.NET MVC, there's nothing wrong with the following code:

<% if (/* my boolean expression condition */ ) { %>
  <!-- Put some other ASP.NET code and/or HTML here. -->
<% } else { %>
  <!-- Do something else. -->
<% } %>