ASPxMenu – How to disable a menu item

<dx:ASPxMenu CssClass=”centered” ID=”ASPxMenu1″ runat=”server” ShowAsToolbar=”true” ShowPopOutImages=”true” OnItemClick=”ASPxMenu1_ItemClick” Enabled=”True” AutoPostBack=”False” EnableCallBacks=”True” Theme=”Moderno” BackgroundImage-VerticalPosition=”top” HorizontalAlign=”Right”>
<ClientSideEvents ItemClick=”function(s, e){ OnMenuItemClick(e); }” />
<Items>
<dx:MenuItem Name=”Add” ToolTip=”Yeni Kayıt Ekle” >
<Image IconID=”data_addnewdatasource_32x32″></Image>
</dx:MenuItem>
<dx:MenuItem Name=”Edit” ToolTip=”Düzenle” >
<Image IconID=”data_editdatasource_32x32″></Image>
</dx:MenuItem>
<dx:MenuItem Name=”Delete” BeginGroup=”true” ToolTip=”Sil” >
<Image IconID=”data_deletedatasource_32x32″></Image>
</dx:MenuItem>
<dx:MenuItem Name=”Approve” BeginGroup=”true” ToolTip=”Onayla” >
<Image IconID=”actions_apply_32x32″></Image>
</dx:MenuItem>
<dx:MenuItem Name=”Cancel” ToolTip=”Vazgeç”>
<Image IconID=”actions_cancel_32x32″></Image>
</dx:MenuItem>

/Items>

</dx:ASPxMenu>

 

c# Code

 

DevExpress.Web.MenuItem itemAdd = ASPxMenu1.Items.FindByName(“Add”);
itemAdd.Enabled = false;
DevExpress.Web.MenuItem itemEdit = ASPxMenu1.Items.FindByName(“Edit”);
itemEdit.Enabled = false;
DevExpress.Web.MenuItem itemDelete = ASPxMenu1.Items.FindByName(“Delete”);
itemDelete.Enabled = false;
DevExpress.Web.MenuItem itemApprove = ASPxMenu1.Items.FindByName(“Approve”);
itemApprove.Enabled = false;
DevExpress.Web.MenuItem itemCancel = ASPxMenu1.Items.FindByName(“Cancel”);
itemCancel.Enabled = false;

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *