GeekArticles
Database
SQL Server
Database
SQL ServerUse MvcContrib Grid to Display a Grid of Data in ASP.NET MVC
<p>
The past six articles in this series have looked at how to display a grid of data in an ASP.NET MVC application and how to implement features like sorting, paging,
and filtering. In each of these past six tutorials we were responsible for generating the rendered markup for the grid. Our Views included the
<code><table></code> tags, the <code><th></code> elements for the header row, and a <code>foreach</code> loop that emitted a series of
<code><td></code> elements for each row to display in the grid. While this approach certainly works, it does lead to a bit of repetition and inflates the size
of our Views.
</p><p>
The ASP.NET MVC framework includes an <a class</a> that adds support
for rendering HTML elements in a View. An instance of this class is available through the <code>Html</code> object, and is often used in a View to create action links
(<code>Html.ActionLink</code>), textboxes (<code>Html.TextBoxFor</code>), and other HTML content. Such content could certainly be created by writing the markup by hand
in the View; however, the <code>HtmlHelper</code> makes things easier by offering methods that emit common markup patterns. You can even
<a your own custom HTML Helpers</a> by adding
<a methods</a> to the <code>HtmlHelper</code> class.
</p><p><a is a popular, open source project that adds various functionality to the ASP.NET MVC framework. This includes
a very versatile <a HTML Helper</a> that provides a strongly-typed way to construct a grid in your
Views. Using Grid HTML Helper you can ditch the <code><table></code>, <code><tr></code>, and <code><td></code> markup, and instead use
syntax like <code>Html.Grid(...)</code>. This article looks at using the MvcContrib Grid to display a grid of data in an ASP.NET MVC application. A future installment
will show how to configure the MvcContrib Grid to support both sorting and paging. Read on to learn more!
<br /><a More ></a></p>
Sponsored Links
Related Topics
Subscribe via RSS
SQL Server
- Naming Database Objects: Part II
- Trace Messages Part V: Trace Cleanup
- Naming Database Objects: Part I
- Multiple-Child Aggregation
- Creating SQL Tables for an Integrating Application Using Dexterity
- SQL Server 2005 Beta 2 Transact-SQL Enhancements
- .NET Rocks! - Brian Larson on SQL Server Reporting Services
- Computing the Trimmed Mean in SQL
- SQL Server 2000 Gains on Oracle
- Separator First Formatting (SFF)
