Saturday, November 12, 2011

All classes should go in the App_Code folder!

Well, no, not really. I'm joking of course. This is has not been seen as good practice since Hurricane Katrina (2005). We only have one file in there: Form Helpers.cshtml ...which looks like:

@helper LinkLikeButton(string value = "Save", string javascript =

         "alert('I should do something more than this.')"){

   <a href="JavaScript:void(0);" onclick="@javascript">@value</a>

}

   

@helper Submit(string value = "Save", string css = ""){

   <input type="submit" value="@value" class="@css" name="submit" />

}

 
 

Use the helpers like so:

@FormHelpers.Submit("Click Me","boldstyle33")

No comments:

Post a Comment