Exploring Cool Features of Devexpress' ASPxGridView
The holiday season is a time for rich food, the warmth of family and friends, and festive fun and good times. And, if you are like me, you were able to squeeze in some computer time when the kiddies were playing their XBoxes or watching their new DVDs in between sledding and ice skating.
Of course, if you are going to play with technology during the holidays, you might as well play with fun technology. When I wasn't fighting the Lich King, I was working with Devexpress controls for Windows and the web. The Windows controls are part of an application I am helping a friend with, and the web controls because Devexpress put out a new release 8.3. Naturally, I wanted to take Devexpress' new controls for a spin.
The article is a little on the long side, so if you want to go refill your eggnog from whatever's left over, I'll wait. Already back, I see. Good.
Binding Persistent Classes to an ASPxGridView
An entity class is a class that represents a database table, generally. It's not worth being dogmatic about where you get your entity classes. Sometimes, you might roll your own, you might use something like Microsoft's LINQ to SQL, or you can use Devexpress' XPO Persistent Classes. The Express Persistent Classes (XPO) are designed to work with Devexpress' XpoDataSource and controls; if you are creating an application that leverages Devexpress' professional looking controls, the XPO Persistent Classes may be the way to go.
Start by creating a new web site project with Visual Studio 2008. To that project, you need to add an XPO class. XPO classes are code-generated in Visual Studio by selecting Project|Add New Item|Persistent Classes 8.3. The wizard will display a dialog labeled "Generating Persistent Classes for an Existing Database" (see Figure 1). The first step lets you pick the provider and the database connection. After you pick the database, click Next and select the table and the columns (see Figure 2). After you click Finish, the Persistent Classes will code-generate entity classes based on your selections. For the demonstration, select the Northwind Traders database and the Products table.
Figure 1: The XPO Persistent Classes item starts a wizard that will code generate entity classes based on your selections.
Figure 2: For the demo, pick the Northwind Traders Products table and all of the columns.
After you click Finish, the Devexpress' XPO technology will generate the classes and properties that represent the tables and columns you selected. Each source file will have a namespace that reflects the database and a class that reflects the tables.
Page 1 of 6