Skip to main content
A newer version of this page is available. .
Tab

ASPxCloudControl.ItemDataBound Event

Occurs after an item has been bound to a data source.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.1.dll

Declaration

public event CloudControlItemEventHandler ItemDataBound

Event Data

The ItemDataBound event's data class is CloudControlItemEventArgs. The following properties provide information specific to this event:

Property Description
Item Gets the cloud control item currently being processed.

Remarks

The ItemDataBound event is raised for each tag cloud item after it’s data bound to the corresponding data from the specified data source. This event enables you to customize settings of the related tag cloud item before it is finally rendered. Handling the ItemDataBound event correctly you can, for example, implement a custom logic to dynamically map properties of a tag cloud control’s items to the required data fields.

The processed tag cloud item can be accessed by using the CloudControlItemEventArgs.Item property of the event’s argument.

protected void ASPxCloudControl1_ItemDataBound(object source, CloudControlItemEventArgs e) {
    e.Item.Text = e.Item.Text.ToUpper();
}

If the control functions in unbound mode, the ItemDataBound event isn’t raised.

Example

This example illustrates how to bind the ASPxCloudControl to a data source. The ASPxCloudControl receives data from an MS Access database. The ASPxCloudControl implements specific properties that point to the data fields containing the necessary data. These are the ASPxCloudControl.TextField, ASPxCloudControl.ValueField and ASPxCloudControl.NavigateUrlField properties. The ASPxCloudControl.ItemDataBound event is used to customize values that are to be assigned to tag cloud element properties during data binding.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" 
Inherits="_Default" %>
<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxCloudControl" tagprefix="dxcc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Page_Load(object sender, EventArgs e) {
        string sql = "select * from country where Continent='North America'";
        AccessDataSource1.SelectCommand = sql;
        ASPxCloudControl1.ValueField = "Area";
    }
    protected void ASPxCloudControl1_ItemDataBound(object source, CloudControlItemEventArgs e) {
        e.Item.Text = e.Item.Text.ToUpper();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <dxcc:ASPxCloudControl ID="ASPxCloudControl1" runat="server" DataSourceID="AccessDataSource1" 
    NavigateUrlField="Name" NavigateUrlFormatString="javascript:void('{0}')" TextField="Name" 
    ValueField="Area" EnableViewState="False" OnItemDataBound="ASPxCloudControl1_ItemDataBound">
        </dxcc:ASPxCloudControl>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Data.mdb">
        </asp:AccessDataSource>
    </div>
    </form>
</body>
</html>
See Also