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.
Codefunction ShowDetailPopup(customerID) {
popup.SetContentUrl('Orders.aspx?id=' + customerID);
popup.SetHeaderText(customerID);
popup.Show();
}
Files to Review
- Default.aspx (VB: Default.aspx)
- Orders.aspx (VB: Orders.aspx)
Example Code
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>
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>