Skip to content

Create a column's template, add a hyperlink to that template, and show a pop-up window with detail grid data on a hyperlink click.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-mvc-grid-display-detail-data-in-popup-window

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid View for ASP.NET MVC - How to display detail data in a pop-up window

This example demonstrates how to create a column's template, add a hyperlink to that template, and show a pop-up window with detail grid data on a hyperlink click.

Display detail data in a pop-up window

Overview

Call a column's SetDataItemTemplateContent method and add a hyperlink control to the template. Handle the hyperlink's Click event. In the handler, specify the URL to the page with detail data, pass the URL as a parameter to the popup control's SetContentUrl method, and invoke a pop-up window.

settings.Columns.Add(col => {
    col.FieldName = "CustomerID";
    col.SetDataItemTemplateContent(container => {
        Html.DevExpress().HyperLink(hlSettings => {
            hlSettings.Name = string.Format("hl_{0}", (container as GridViewDataItemTemplateContainer).VisibleIndex);
            hlSettings.NavigateUrl = "javascript:void(0)";
            hlSettings.Properties.ClientSideEvents.Click = string.Format("function(s, e) {{ ShowDetailPopup('{0}'); }}", Url.Action("DetailAction", "Home", new { _customerID = (container as GridViewDataItemTemplateContainer).KeyValue.ToString() }));
            hlSettings.Properties.Text = "Show Orders";
        }).Render();
    });
});
function ShowDetailPopup(url) {
    popup.SetContentUrl(url);
    popup.Show()
}

Files to Review

Documentation

More Examples