ASPxClientCardView.CardClick Event
Fires on the client when a card is clicked.
Declaration
CardClick: ASPxClientEvent<ASPxClientCardViewCardClickEventHandler<ASPxClientCardView>>
Event Data
Example
This example illustrates how to use the client-side CardClick and CardDblClick events to perform different actions.
View Example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v15.1, Version=15.1.6.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">
var doProcessClick;
var visibleIndex;
function ProcessClick() {
if (doProcessClick) {
alert("Here is the CardClick action in the " + visibleIndex.toString() + "-th card");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" KeyFieldName="CategoryID">
<ClientSideEvents
CardClick="function(s, e) {
doProcessClick = true;
visibleIndex = e.visibleIndex+1;
window.setTimeout(ProcessClick,500);
}"
CardDblClick="function(s, e) {
doProcessClick = false;
var key = s.GetCardKey(e.visibleIndex);
alert('Here is the CardDoubleClick action in a card with the Key = '+key);
}" />
<SettingsBehavior AllowFocusedCard="True" />
<Columns>
<dx:CardViewTextColumn FieldName="CategoryID" ReadOnly="True" VisibleIndex="0">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="CategoryName" VisibleIndex="1">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="Description" VisibleIndex="2">
</dx:CardViewTextColumn>
</Columns>
</dx:ASPxCardView>
<asp:accessdatasource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb" SelectCommand="SELECT * FROM [Categories]"></asp:accessdatasource>
</div>
</form>
</body>
</html>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v15.1, Version=15.1.6.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">
var doProcessClick;
var visibleIndex;
function ProcessClick() {
if (doProcessClick) {
alert("Here is the CardClick action in the " + visibleIndex.toString() + "-th card");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" KeyFieldName="CategoryID">
<ClientSideEvents
CardClick="function(s, e) {
doProcessClick = true;
visibleIndex = e.visibleIndex+1;
window.setTimeout(ProcessClick,500);
}"
CardDblClick="function(s, e) {
doProcessClick = false;
var key = s.GetCardKey(e.visibleIndex);
alert('Here is the CardDoubleClick action in a card with the Key = '+key);
}" />
<SettingsBehavior AllowFocusedCard="True" />
<Columns>
<dx:CardViewTextColumn FieldName="CategoryID" ReadOnly="True" VisibleIndex="0">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="CategoryName" VisibleIndex="1">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="Description" VisibleIndex="2">
</dx:CardViewTextColumn>
</Columns>
</dx:ASPxCardView>
<asp:accessdatasource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb" SelectCommand="SELECT * FROM [Categories]"></asp:accessdatasource>
</div>
</form>
</body>
</html>
See Also