Git Product home page Git Product logo

devexpress-examples / how-to-display-detail-data-within-a-popup-window-using-aspxpopupcontrol-content-elements-e5202 Goto Github PK

View Code? Open in Web Editor NEW
0.0 55.0 2.0 70 KB

Create a template in a master grid, add a button to the template, and display a pop-up window with detail grid data on a button click.

License: Other

C# 13.30% ASP.NET 72.56% Visual Basic .NET 14.14%
dotnet aspxgridview asp-net master-detail popup-window

how-to-display-detail-data-within-a-popup-window-using-aspxpopupcontrol-content-elements-e5202's Introduction

Grid View for ASP.NET Web Forms - How to display detail grid data in a popup window

[Run Online]

This example demonstrates how to create a template in a master grid, add a button to the template, and display a pop-up window with detail grid data on a button click.

Detail Data

Overview

Follow the steps below to display detail grid data in a pop-up window:

  1. Specify a column's DataItemTemplate property and add a button to the template.

    <dx:GridViewDataColumn FieldName="DetailButtons" VisibleIndex="3">
        <DataItemTemplate>
            <dx:ASPxButton ID="DetailButton" runat="server" Text="Show details" AutoPostBack="false"
                OnLoad="DetailsButton_Load">
            </dx:ASPxButton>
        </DataItemTemplate>
    </dx:GridViewDataColumn>
  2. Handle the button's server-side Load event to access the button's template container and get the master row's key value. Pass this key value as a parameter to the button's client-side Click event.

    protected void DetailsButton_Load(object sender, EventArgs e) {
        ASPxButton btn = sender as ASPxButton;
        GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer;
        string categoryID = DataBinder.Eval(container.DataItem, "CategoryID").ToString();
        btn.ClientSideEvents.Click = String.Format("function (s, e) {{ OnClick(s, e, {0}) }}", categoryID);
    }
  3. In the button's Click event handler, send a callback to a popup control and display the pop-up window with detail grid data on the callback.

    function OnClick(s, e, categoryID) {
        Popup.PerformCallback(categoryID);
        Popup.Show();
    }
  4. Handle the popup's server-side WindowCallback event to get a detail data source and bind the detail grid to that data source.

    protected void Popup_WindowCallback(object source, PopupWindowCallbackArgs e) {
        CurrentCategoryID = e.Parameter;
        DetailsApply();
    }
    private void DetailsApply() {
        if (!String.IsNullOrEmpty(CurrentCategoryID)) {
            DetailSource.SelectParameters["CategoryID"].DefaultValue = CurrentCategoryID;
            DetailGrid.DataBind();
        }
    }

Files to Review

Documentation

More Examples

how-to-display-detail-data-within-a-popup-window-using-aspxpopupcontrol-content-elements-e5202'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

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.