Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Collapse]Grid View
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Expand]Concepts
    ASPxGridView Designer
   [Expand]Visual Elements
   [Collapse]Examples
     How to: Add an Unbound Column to Supply Additional Data
     How to: Add and Initialize a New Row
     How to: Add Custom Filter Values to the Filter Dropdown
     How to: Bind the ASPxGridView to Data Created at Runtime (DataTable)
     How to: Bind to an ArrayList
     How to: Calculate Custom Total Summaries
     How to: Change the Style Settings of Individual Data Cells
     How to: Create an ASPxGridView at Runtime
     How to: Create and Customize a Group Summary
     How to: Create Custom Command Buttons
     How to: Create Edit Form Template at Runtime
     How to: Create Total Summaries
     How to: Delete Selected Rows
     How to: Display a Context Menu For Column Headers
     How to: Display Images within Preview Rows
     How to: Display Master-Detail Data (XPO)
     How to: Display Real-Time Data
     How to: Dynamically Change Images Displayed Within Data Cells
     How to: Dynamically Display the Focused Row's Values Outside the ASPxGridView
     How to: Export ASPxGridView Data as a PDF
     How to: Filter Data by Multiple Columns
     How to: Filter Records
     How to: Generate Persistent Objects for Existing Data Tables
     How to: Hide Expand Buttons for Master Rows That Have Empty Details
     How to: Implement Custom Grouping
     How to: Implement Custom Sorting
     How to: Implement Data Editing When a Grid is Bound to a Table Created At Runtime
     How to: Implement Master-Detail at Runtime (XPO)
     How to: Obtain Server Data From the Client
     How to: Present Data in Cards
     How to: Provide Custom Display Text for Data Cells
     How to: Render a Different Content From Default Exporting
     How to: Save and Restore the ASPxGridView's Layout
     How to: Save Changes and Switch to Browse Mode by Clicking ENTER
     How to: Select Rows That Contain the Specified Value
     How to: Show Detail Information in a Separate ASPxGridView
     How to: Sort Groups by Summary Values
     How to: Switch ASPxGridView to an Edit Mode by Double-Clicking a Row
     How to: Use a Hyperlink Whose Argument Depends on Several Cell Values in the ASPxGridView
     How to: Validate Data On the Client
     How to: Validate Rows
   [Expand]Member Tables
   [Expand]ASPxGridView - Animated Images
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Implement Master-Detail at Runtime (XPO)

This example shows how to create ASPxGridView controls at runtime to display master-detail data.

 

  1. Define Persistent Classes
  2. Connect to a Database Server
  3. Retrieve Data From the Database
  4. Create Detail ASPxGridView
  5. Create Master ASPxGridView

Expanded 1. Define Persistent Classes

Note

For detailed information on creating XPObjects, please see Tutorial 1 - Your First Data-Aware Application with XPO and Tutorial 2 - Relations (One to Many).

Expanded 2. Connect to a Database Server

To connect XPO to a database server, create an IDataLayer object. The code that creates the data layer must be placed inside the Application_Start event handler in the Global.asax module of your webste. For more information, see Connecting XPO to a Database Server (ASP.NET).

Expanded 3. Retrieve Data From the Database

To retrieve data from the database, use the XpoDataSource components.

  • Master: Customers

    Set its TypeName property to Customer.

  • Detail: Orders

    Set its TypeName to Order.

    Use the Criteria property to specify the filter condition. Set this property to '[Customer.Oid] = ?'.

    Invoke the Parameter Collection Editor, and add a criteria parameter. This parameter gets its value at runtime from the "Oid" Session field.

  • Handle the page's Init event to bind XpoDataSource components to a database.

Expanded 4. Create Detail ASPxGridView

Expanded 5. Create Master ASPxGridView

How would you rate this topic?​​​​​​​