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

ASPxClientPopupControlBase.PopUp Event

Occurs on the client side when a control’s window is invoked.

Declaration

PopUp: ASPxClientEvent<ASPxClientPopupWindowEventHandler<ASPxClientPopupControlBase>>

Event Data

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

Property Description
window Gets the popup window object related to the event.

Remarks

Write a PopUp event handler to perform specific actions on the client side when a control’s window is being invoked (in particular, before the window’s invoking animation has been completed).

The PopUp event provides an argument of the ASPxClientPopupWindowEventArgs type. The event argument’s ASPxClientPopupWindowEventArgs.window property allows you to access the popup window which is being displayed.

Example

This example demonstrates how to implement a kind of an image gallery with an image preview.Image thumbnails are displayed by ASPxDataView that is used in Flow layout mode. In this mode, image thumbnails flow one after another, to fill the available page area within the browser window in the best possible way. When hovering a thumbnail, ASPxPopupControl is invoked to display a large (zoomed) image. During zoomed image loading, ASPxPopupControl displays a thumbnail image enlarged to the zoomed image size.The specificity of this example is that image previews are displayed with the help of a single ASPxPopupControl that is dynamically linked to multiple invoker elements via client code. The client SetPopupElementID method is used to associate ASPxPopupControl with multiple instances of a thumbnail image element placed within ASPxDataView's ItemTemplate.From this example, you can also learn how to dynamically generate two images - thumbnail and preview - from an original image and how to apply a watermark to a large preview image.

using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxClasses;
using DevExpress.Web.ASPxClasses.Internal;
using DevExpress.Web.ASPxDataView;

public partial class Examples_Default2 : System.Web.UI.Page {
    protected void galleryDV_CustomJSProperties(object sender, CustomJSPropertiesEventArgs e) {
        var itemDetails = new Dictionary<string, object>();
        foreach(DataViewItem item in galleryDV.Items.GetVisibleItems()) {
            var key = GetImageID(GetItemValue(item, "ID"));
            itemDetails[key] = GetItemDetail(item);
        }
        e.Properties["cpItemDetails"] = itemDetails;
    }
    protected object GetItemDetail(DataViewItem item) {
        Dictionary<string, object> itemDetail = new Dictionary<string, object>();
        itemDetail.Add("description", GetItemValue(item, "Description"));
        itemDetail.Add("highQualityImageUrl", GetItemValue(item, "LargeImageUrl"));
        itemDetail.Add("imageWidth", GetItemValue(item, "Width"));
        itemDetail.Add("imageHeight", GetItemValue(item, "Height"));
        return itemDetail;
    }
    protected object GetItemValue(DataViewItem item, string fieldName) {
        return DataBinder.Eval(item.DataItem, fieldName);
    }
    protected string GetImageID(object id) {
        return string.Format("img_{0}", id);
    }
}
See Also