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

ASPxClientPopupControl.SetPopupElementID(popupElementId) Method

Sets the ID of a web control or HTML element (or a list of IDs) with which the current popup control is associated.

Declaration

SetPopupElementID(
    popupElementId: string
): void

Parameters

Name Type Description
popupElementId string

A string value specifying the ID (or a list of IDs) of the web control or HTML element to which the popup control is associated.

Remarks

Use the client SetPopupElementID method to specify the web control or HTML element whose specific mouse action defined via the ASPxPopupControl.PopupAction property invokes the default popup window. You can also specify a list of control IDs separated by a semicolon (;).

clientPopupControl.SetPopupElementID('ASPxButton1;ASPxButton2;ASPxButton3;ASPxButton4');

To specify the same value on the server side, use the ASPxPopupControl.PopupElementID property.

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