Choosing The GridView
The GridView is one of the most powerful and useful controls in the ASP.NET arsenal:
|
|
 |
|
| Basic GridView Tag |
<asp:GridView ID="GridView1" runat="server">
</asp:GridView> |
|
|
In particular, it renders an HTML <table> that can handle sorting and paging. An immense time-saver:
|
|
 |
|
| GridView Tag with Sorting and Paging |
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" AllowSorting="True">
</asp:GridView> |
|
|
There are basically two ways to manipulate the GridView: rely on IDE features or code.
Popular IDE features include EditTemplates, SqlDataSources, etc. They seem simple and powerful, and they are. Many tasks can be completed quickly. True enough. However, there frequently arises a need for some specific custom functionality. Those easy-to-use IDE features can suddenly become a heavy burden and produce 'ugly' results. Code has much better control, but has a bit of a learning curve.
A student or hobbyist can decide not to include functionality virtually at will. Most professional web developers must solve issues and meet expectations. It might not be a good career move for a developer to depend on IDE features to manipulate GridViews. Mastering the GridView in code is a valuable career skill for a .NET web developer.
And remember, there is also a good alternative to GridViews in some situations. The 'old-school' technique of looping through rows and building a HTML <table>. Simple, quick and efficient. If all you need to do is display tabular data, it may be the best choice. Just because you can use a GridView, it doesn't mean you have to or should.
|
|
| |
|
| |
|
| |
|
|