Back to Devexpress

ASPxPopupMenu.PopupElementID Property

aspnet-devexpress-dot-web-dot-aspxpopupmenu-fb3ba8ff.md

latest4.6 KB
Original Source

ASPxPopupMenu.PopupElementID Property

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

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("")]
public string PopupElementID { get; set; }
vb
<DefaultValue("")>
Public Property PopupElementID As String

Property Value

TypeDefaultDescription
StringString.Empty

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

|

Remarks

Use the PopupElementID property to specify the web control or HTML element whose specific mouse action defined via the ASPxPopupMenu.PopupAction property invokes the current popup menu control. You can also specify a list of control IDs separated by the semicolon ( ; ) sign.

aspx
PopupElementID="ASPxGridView1;ASPxGridView2;ASPxGridLookup1"

To specify this value on the client side, use the ASPxClientPopupMenu.SetPopupElementID method.

Note

The PopupElementID property should be set to a control’s ASPxWebControlBase.ClientID property when the menu and control are placed in different containers.

aspx
<dx:ASPxPanel ID="ASPxPanel1" runat="server" Width="100%">
     <PanelCollection>
          <dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
               <dx:ASPxTreeList ID="MyTreeList" runat="server" Width="100%" AutoGenerateColumns="False">
                    <Columns>
                         ...
                    </Columns>
               </dx:ASPxTreeList>
          </dx:PanelContent>
     </PanelCollection>
</dx:ASPxPanel>
<dx:ASPxPopupMenu ID="popupMenu" runat="server" AutoPostBack="true" OnLoad="popupMenu_Load">
     <Items>
          ...
     </Items>
</dx:ASPxPopupMenu>
csharp
protected void popupMenu_Load(object sender, EventArgs e) {
     (sender as ASPxPopupMenu).PopupElementID = MyTreeList.ClientID;
}
vb
Protected Sub popupMenu_Load(ByVal sender As Object, ByVal e As EventArgs)
     TryCast(sender, ASPxPopupMenu).PopupElementID = MyTreeList.ClientID
End Sub

Example

aspx
<dx:ASPxPopupMenu ID="ASPxPopupMenu1" runat="server" OnPopupElementResolve="ASPxPopupMenu1_PopupElementResolve" PopupElementID="ASPxButton1">
    <Items>
        <dx:MenuItem Text="Red Item">
            <TextTemplate>
                <span style="color:Red;">Red Item</span>
            </TextTemplate>
        </dx:MenuItem>
        <dx:MenuItem Text="Yellow Item">
            <TextTemplate>
                <span style="color:Yellow;">Yellow Item</span>
            </TextTemplate>                
        </dx:MenuItem>
        <dx:MenuItem Text="Green Item">
            <TextTemplate>
                <span style="color:Green;">Green Item</span>
            </TextTemplate>                
        </dx:MenuItem>
    </Items>
    <ClientSideEvents ItemClick="function(s,e) {alert('The item with index = ' + e.item.index.toString() + ' was clicked');}"/>
</dx:ASPxPopupMenu>
csharp
protected void ASPxPopupMenu1_PopupElementResolve(object sender, ControlResolveEventArgs e) {
    e.ResolvedControl = ASPxButton1;
}
vb
Protected Sub ASPxPopupMenu1_PopupElementResolve(ByVal sender As Object, ByVal e As ControlResolveEventArgs)
    e.ResolvedControl = ASPxButton1
End Sub

See Also

PopupAction

SetPopupElementID(popupElementId)

ASPxPopupMenu Class

ASPxPopupMenu Members

DevExpress.Web Namespace