Behold the Power of the DataGrid! - What on Earth is a DataGrid?
(Page 2 of 4 )
Ok, how do I best explain this? All right, a common use of server-side programming is to retrieve data from a database and display it on a web page. You can then do additional things with the displayed data, such as give the users the option of adding one or more of the items to a shopping cart, perhaps giving moderators the ability to modify individual chucks of that data. Then, as you get more data, you'll want to add advanced features, like displaying incremental portions of the data, referred to as paging.
Now all of these things can be accomplished with plain old ASP, and you'll find lots of help on ASP Free if that's what you want to do. But trust me, for every extra option you want, you've got approximately 1.5 million lines of code to type out (maybe a slight exaggeration). Then you have to go back and debug your improperly displayed tables. Then you have to add in client-side JavaScript to accomplish something fancy, then debug that! Then if you need to reuse the functionality in another page or application, there's usually a good deal of time wasted on figuring out where to copy and modify your code, then of course more debugging time.
If you're thinking I have a chip on my shoulder here, you may be justified with such thoughts. This is only the case however, since I learned of an infinitely better way of doing it all. I was quite happy to whittle away the hours before, but now that Microsoft has taken such huge steps towards Rapid Application Development, I'm quite happy to change with the times.
With ASP.NET, Microsoft realized that thousands of people are trying to do the very same or similar things in their ASP applications, so why not give them a much better way to do it? And thus is born the DataGrid. We can 'bind' the DataGrid to a dataset, and have it spit it all out in tabular format in a very automated fashion. We can easily configure advanced options like sorting and paging, by merely configuring a few attributes of the DataGrid.
Excited yet? It's OK, you don't have to hide your excitement, you don't have to be worried about being called a geek. We all are, that's why we're here! Throughout the following articles, we will discuss the various options of a DataGrid, including:
- Data binding
- Configuring display
- Alternate row styling
- Sorting
- Paging
- Selecting
- Updating
Next: Data Binding >>
More ASP.NET Articles
More By Justin Cook