ASPxMenuBase.EnableClientSideAPI Property
Gets or sets a value that specifies whether the menu can be manipulated on the client side via code.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
Remarks
The EnableClientSideAPI property controls the availability of the client-side API for the control.
A menu control implements a comprehensive JavaScript-written client-side object model (client API), allowing you to programmatically manipulate the control on the client.
If you want to use the control’s client-side API in your application, set the EnableClientSideAPI property to true, to make sure that the client API is available on the client side.
Note
Regardless of the EnableClientSideAPI property setting, the client-side API is automatically enabled if the ASPxMenuBase.ClientInstanceName property is defined, or any client event exposed by the ASPxMenuBase.ClientSideEvents property is handled.
Example
This part of the Templates demo illustrates how to use template technology within the ASPxMenu control.
A specific MenuItem.SubMenuTemplate property is used to define the template for the first root menu item’s submenu. The content of a SubMenuTemplate type is represented by the ASPxSiteMapControl, which displays a hierarchical structure of links (site map nodes) that reference different web pages within the site.
The appearance of the second root menu item’s sub-item is defined via the MenuItem.Template property of each sub-item.
<dxm:ASPxMenu BorderBetweenItemAndSubMenu="HideRootOnly" EnableViewState="False"
EnableClientSideAPI="true" ID="ASPxMenu1" AutoSeparators="None" runat="server"
ShowSubMenuShadow="true" ItemImagePosition="Right" GutterWidth="0px"
ShowPopOutImages="True">
<Items>
<dxm:MenuItem Text="SubMenu Template" Name="submenu">
<Items>
<dxm:MenuItem />
</Items>
<SubMenuTemplate>
<dxsm:ASPxSiteMapControl EnableViewState="False" ID="ASPxSiteMapControl1"
runat="server" DataSourceID="ASPxSiteMapDataSource1">
...
</dxsm:ASPxSiteMapControl>
</SubMenuTemplate>
</dxm:MenuItem>
<dxm:MenuItem Text="Item Template" Name="item">
<SubMenuStyle Paddings-Padding="8px" Font-Size="10px" Font-Names="Verdana"
Wrap="False" ForeColor="#000000" />
<Items>
...
<dxm:MenuItem Text="Email" Name="email" BeginGroup="true">
<Template>
<dxe:ASPxLabel ID="Label2" EnableViewState="false"
AssociatedControlID="TextBox1" runat="server"
Text="<%# Container.Item.Text %>" Font-Size="10px"
ForeColor="#003399" Font-Bold="true" />
<table border="0" cellpadding="0" cellspacing="0"
style="margin-top: 4px;" width="260px">
<tr>
<td style="width: 100%;"><dxe:ASPxTextBox ID="TextBox1"
runat="server" EnableViewState="false" Width="100%" />
</td>
<td style="padding-left: 3px;"><dxe:ASPxButton ID="Button1"
runat="server" EnableViewState="False" Text="Subscribe"
AutoPostBack="False">
<ClientSideEvents Click="function(s, e) {
ASPxClientMenuBase.GetMenuCollection().HideAll(); return false;
}" />
</dxe:ASPxButton></td>
</tr>
</table>
</Template>
</dxm:MenuItem>
</Items>
</dxm:MenuItem>
</Items> </dxm:ASPxMenu>