2009-01-29
| Table of Contents: |
| Rate This Article: | Add This Article To: |
( Page 4 of 5 )
Configuring Essential Nesting Properties and Storing the Session Variable
To wrap up you need to select the nested grid (Order Details) in the Properties window, expand the SettingsDetail property and change the sub-property IsDetailGrid to True (see Figure 6). In the grid containing Orders open the Property window, expand SettingsDetail and set ShowDetailRow to True, and add the code in Listing 1.

Figure 6: Set SettingsDetail|IsDetailGrid to true for the ASPxGridView representing the nested grid.
Listing 1: One line of code stuffs the master grid’s key into session to correlate the master grid with each child grid containing Order Details.
Imports DevExpress.Web.ASPxGridView
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub ASPxGridView2_BeforePerformDataSelect(ByVal sender As Object, _
ByVal e As EventArgs)
Session("OrderID") = CType(sender, ASPxGridView).GetMasterRowKeyValue()
End Sub
End Class
Create an event handler for the detail grid’s BeforePerformDataSelect event and obtain the primary key for Orders by calling the GebtMasterRowKeyValue and storing it in the Session variable (OrderID) created in the Data Source wizard. When you run the example the results should look consistent with Figure 7.

Figure 7: Order Details nested in the Orders ASPxGrdView with the first Order expanded to show the nested grid.
![]() |
|


