2.21. Displaying a Pop-Up Details Window

Problem

You want to provide additional details for each row in a GridView using a pop-up window.

Solution

Add a Details button to each row in the GridView. When the user clicks the button, open a new browser window, obtain the information from the server, and display the detailed information in a pop-up window. An example of the possible output is shown in Figures 2-23 (sample GridView) and Figures 2-24 (sample pop-up window output). As with the other recipes in this book, we’ve implemented a complete application that illustrates this approach. The form and code-behind for the page containing the sample GridView is shown in Examples 2-57, 2-58 through 2-59, and the form and code-behind for the sample pop-up window is shown in Examples 2-60, 2-61 through 2-62.

GridView with pop-up details window output

Figure 2-23. GridView with pop-up details window output

Discussion

To implement this solution, create a GridView in the normal fashion but add a link button column to display a Details link. When the user clicks the Details link within a row of the GridView, the browser opens a new window and requests the appropriate page from the server. In the context of our example that implements this solution, a book details page is requested. From here on, the recipe’s remaining steps are described in the context of our example because we use techniques that you are likely to find helpful in implementing ...

Get ASP.NET 2.0 Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.