Example T339685
Visible to All Users

Card View for ASP.NET Web Forms - How to display detail data in a pop-up window

In this example, ASPxCardView contains a hyperlink column.

ASPx
<dx:CardViewHyperLinkColumn FieldName="CustomerID" > <PropertiesHyperLinkEdit NavigateUrlFormatString="javascript:ShowDetailPopup('{0}');" /> </dx:CardViewHyperLinkColumn>

When a user clicks a hyperlink, a pop-up window opens that displays detail data: orders of the current customer. The SetContentUrl method specifies the web page (Orders.aspx) to be displayed in the window and the query parameter (customerID) to select data from the database.

Code
function ShowDetailPopup(customerID) { popup.SetContentUrl('Orders.aspx?id=' + customerID); popup.SetHeaderText(customerID); popup.Show(); }

Files to Review

Example Code

Orders.aspx
ASPx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Orders.aspx.cs" Inherits="Orders" %> <%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.20.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="OrderID"> <Columns> <dx:CardViewTextColumn FieldName="OrderID" /> <dx:CardViewDateColumn FieldName="OrderDate" /> </Columns> </dx:ASPxCardView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [OrderID], [CustomerID], [OrderDate], [ShipCity] FROM [Orders]" FilterExpression="CustomerID='{0}'"> <FilterParameters> <asp:QueryStringParameter Name="CustomerID" QueryStringField="id" /> </FilterParameters> </asp:SqlDataSource> </div> </form> </body> </html>
Default.aspx
ASPx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.20.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function ShowDetailPopup(customerID) { popup.SetContentUrl('Orders.aspx?id=' + customerID); popup.SetHeaderText(customerID); popup.Show(); } </script> </head> <body> <form id="form1" runat="server"> <div> <dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="CustomerID"> <Columns> <dx:CardViewHyperLinkColumn FieldName="CustomerID" > <PropertiesHyperLinkEdit NavigateUrlFormatString="javascript:ShowDetailPopup('{0}');" /> </dx:CardViewHyperLinkColumn> <dx:CardViewTextColumn FieldName="CompanyName" /> <dx:CardViewTextColumn FieldName="ContactName" /> <dx:CardViewTextColumn FieldName="City" /> </Columns> </dx:ASPxCardView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [City] FROM [Customers]"></asp:SqlDataSource> <dx:ASPxPopupControl ID="ASPxPopupControl1" ClientInstanceName="popup" Width="800px" Height="400px" runat="server"> <ContentCollection> <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server" /> </ContentCollection> </dx:ASPxPopupControl> </div> </form> </body> </html>

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.