Giter Site home page Giter Site logo

devexpress-examples / a-simple-example-of-master-detail-grids-with-editing-capabilities-e248 Goto Github PK

View Code? Open in Web Editor NEW
0.0 55.0 1.0 414 KB

Use a detail row template to display master-detail data.

License: Other

C# 13.16% ASP.NET 86.84%
dotnet aspxgridview asp-net master-detail

a-simple-example-of-master-detail-grids-with-editing-capabilities-e248's Introduction

Grid View for ASP.NET Web Forms - Simple master-detail implementation

This example demonstrates how to use a detail row template to display master-detail data.

Master-Detail Implementation

Overview

Follow the steps below to enable the master-detail functionality:

  1. Create a master Grid View control, bind it to a data source, and enable the grid's ShowDetailRow property.

    <dx:ASPxGridView ID="masterGrid" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceCustomers" KeyFieldName="CustomerID" ... >
        <!-- ... -->
        <SettingsDetail ShowDetailRow="True" />
    </dx:ASPxGridView>
  2. Specify the master grid's GridViewTemplates.DetailRow property and add a detail grid to the template. Bind the detail grid to a data source and handle the grid's server-side BeforePerformDataSelect event. In the handler, call the grid's GetMasterRowKeyValue method to obtain the key value of the corresponding row in the master grid.

    <Templates>
        <DetailRow>
            <dx:ASPxGridView ID="detailGrid" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceOrders"
                KeyFieldName="OrderID" OnBeforePerformDataSelect="detailGrid_BeforePerformDataSelect" ... >
                <!-- ... -->
            </dx:ASPxGridView>
        </DetailRow>
    </Templates>
    protected void detailGrid_BeforePerformDataSelect(object sender, EventArgs e) {
    	Session["CustomerID"] = (sender as ASPxGridView).GetMasterRowKeyValue();
    }
  3. Handle the grid's server-side RowDeleting, RowInserting, and RowUpdating events to configure the grid's edit functionality.

Files to Review

Documentation

a-simple-example-of-master-detail-grids-with-editing-capabilities-e248's People

Contributors

devexpressexamplebot avatar elenapeskova avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

elenapeskova

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.