Articles : Page 5 of 5
- Filter:
- Views
-
NuGet Package of the Week #1 - ASP.NET Sprite and Image Optimization
Mar 1107I was thinking since the NuGet .NET package management site is starting to fill up that I should start looking for gems (no pun intended) in there. You know, really useful stuff that folks might otherwise not find. I'll look for mostly open source projects, ones I think are really useful. I'll look at how they built their NuGet packages, if there's anything interesting about the way the designed the out of the box experience (and anything they could do to make it better) as well as what the p...
-
Defining Default Content For A Razor Layout Section
Mar 1105Layouts in Razor serve the same purpose as Master Pages do in Web Forms. They allow you to specify a layout for your site and carve out some placeholder sections for your views to implement. For example, here’s a simple layout with a main body section and a footer section. <!DOCTYPE html> <html> <head><title>Sample Layout</head> <body> <div>@RenderBody()</div> <footer>@RenderSection("Footer")</footer> </body> </html> In order to use this layout, your view might look like. @{ Layout ...
-
Changing Base Type Of A Razor View
Feb 1121Within a Razor view, you have access to a base set of properties (such as Html, Url, Ajax, etc.) each of which provides methods you can use within the view. For example, in the following view, we use the Html property to access the TextBox method. @Html.TextBox("SomeProperty") Html is a property of type HtmlHelper and there are a large number of useful extension methods that hang off this type, such as TextBox. But where did the Html property come from? It’s a property of System.We...

