Sometimes understanding how something is designed helps one understand all of the resources available. The ASPxGridView is very easy to use at its most fundamental level. Bind the ASPxGridView to a data source, set a few properties and you have a wide variety of viewing and editing features at your disposal. The ASPxGridView supports row editing, forms editing, and grid nesting—as described in our book Professional DevExpress ASP.NET Controls. However, all of this functionality comes at a cost. Fortunately for our customers the cost has been paid in terms of design and development by our internal ASPxGridView programmers. You could in fact use the ASPxGridView daily and not be aware of all of the infrastructure and plumbing that makes it so powerful yet easy to use.
Figure 1 shows you all of the interfaces and classes that make the grid columns work starting with the .NET Object class down to specific kinds of grid columns, like the GridViewDataBinaryImageColumn. (Read the model from top to bottom.) When you use the designer to bind data to a grid the actual columns are generated as instances of the GridViewDataxxx columns, rendered declaratively as tags in the ASPX. The specific column class determines the kind of editor the user will experience—whether a combobox, date/time editor, button or link.
Of course, you don’t have to memorize this information (or the model) to use the ASPxGridView but on rare occasions it doesn’t hurt to know. One such occasion is when you have a binary blob column that is actually an image. The ASPxGridView won’t guess that BLOB (binary columns) are always images, so images may be displayed—and generated as a GridViewDataTextColumn—as text. Usually the content is something like system.byte[]. Obviously this isn’t what you want. By knowing that the data is an image you can simply change the ASPX tag from GridViewDataTextColumn to a GridViewDataBinaryImage column and the image will magically appear at runtime.
Figure 1: The classes and interfaces that make up the ASPxGridViewColumns.
I was talking to a charming woman on the plane Monday, and in passing we talked about books. She said that she hadn’t read the Harry Pottter books. I said that in fact I had and that I enjoyed them. I enjoy them because an implied message in the books is that new knowledge can be obtained from reading, and knowledge imparts a magical power: information that can be used, employed, acted upon.