- What is the GridView control
- Common Properties
- The Columns collection
- GridView events - what you absolutely need to know
- Tricks of the Grid
The GridView Control
The GridView control is an ASP.NET control for formatting a set of data in a consistent manner. In web development the most common task asked for is the layout the results of a database query into a table on screen and allow the user to interact with that data. This used to involved tons of code, paging routines, and it caused a huge mess.The GridView control simplifies this way, way, down while still allowing you some very fine grain control. At its most basic a GridView control requires 1 markup line and 3 code behind lines.
Markup:
Code Behind:
string sql = "Query"
GridView.DataSource = Your.DataAccessLayer.QueryAsDataTable(sql);
GridView.DataBind();
Done. Yeah, yeah I took a shortcut and ignored things like in-page DataSources and I didn't actually tell you how to build your Data Access Layer, but these are things I wax poetic on later.

No comments:
Post a Comment