Visual Studio 2010!

Read now >

View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.
ADVERTISEMENT
ADVERTISEMENT

 

DevSource.com: Your Source for Visual Studio on Facebook
ADVERTISEMENT
Master-Detail Nested Grids with DevExpress' ASPxGridView
By Paul Kimmel

Rate This Article: Add This Article To:

Master-Detail Nested Grids with DevExpress' ASPxGridView - Configuring the Dat a Source
( Page 2 of 5 )

Configuring the SqlDataSource

You can use whatever data source that makes sense for your solution like DevExpress’ XPO (persistent objects) data source or LINQ, but for this example uses the SqlDataSource. You will need to configure a SqlDataSource for each of the two tables—Orders and Order Details—but the steps are identical for each data source.

To configure the SqlDataSource for the Orders table follow these steps:

  1. Click the task button in the upper right-hand corner of the ASPxGridView and select Choose Data Source|<New Data Source>. (This step will kick off the Data Source Configuration Wizard).
  2. In the Choose Data Source Type step select the Database item and click Next. (You can use the default ID for the data source).
  3. In the Choose Your Data Connection step pick an existing connection to the Northwind database or create a new connection.
  4. In the Choose the Select Statement step select the Orders table and select the fields you want (see Figure 1)
  5. Click Next.
  6. Click Finish.

Drop a second ASPXGridView anywhere on the Web page and repeat steps 1 through 6 above to configure the Order Details table. Add a step in the Configure Data Source step, step 2 and click the WHERE button to configure a WHERE clause for Order Details (see Figure 2). Follow these steps to configure the WHERE clause for Order Details:

  1. In Step 2 above Click the WHERE button (see Figure 1).
  2. In the Column drop down (see Figure 2) select the OrderID column.
  3. Select the = Operator from the operator dropdown.
  4. Select Session from the Source dropdown.
  5. For the Session value use @OrderID.
  6. Click Add. (The results after you click Add should look like Figure 2)


Figure 1: Configure the table and columns to select. (Figure 1 shows the Order Details table with all columns selected)


Figure 2: Add a WJERE clause to correlate Orders to Order Details by OrderID as shown.

After you finish configuring the two SqlDataSources above you will need to use the Web page designer to nest the grids.



 
 
>>> More Microsoft and Visual Studios Add Ons Articles          >>> More By Paul Kimmel