The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientNavBarItem.SetVisible(value) Method

Specifies whether the item is visible.

Declaration

SetVisible(value: boolean): void

Parameters

Name Type Description
value boolean

true is the item is visible; otherwise, false.

Remarks

Use the SetVisible method to dynamically define an item's visible state on the client. The original item's visibility can be defined by using the NavBarItem.ClientVisible property.

Note

If an item's server NavBarItem.Visible property is set to false, this item is not rendered into the web page at all, so it can't be manipulated on the client side.

Examples

This example demonstrates how specific item characteristics (the text, visibility, availability to end-users, checked state) of a control (the ASPxMenu in this case) can be changed on the client side using available JavaScript methods.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="DevExpress.Web.v8.3" Namespace="DevExpress.Web.ASPxMenu" 
TagPrefix="dxm" %>
<%@ Register Assembly="DevExpress.Web.v8.3" Namespace="DevExpress.Web.ASPxEditors" 
TagPrefix="dxe" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
 <head id="Head1" runat="server">
     <title>Client methods that affect an item's visibility, 
    text, navigation location and associated image</title>
 </head>
 <body>
     <form id="form2" runat="server">
     <div>
         <table border="0" cellpadding="2" cellspacing="0"><tr>
             <td><dxe:ASPxCheckBox ID="cbVisible" Checked="True" runat="server" Text="Visible">
                 <ClientSideEvents CheckedChanged="function(s, e) {
    myMenu.GetItem(0).SetVisible(s.GetChecked());
 }" />
             </dxe:ASPxCheckBox></td>
         </tr><tr>
             <td><dxe:ASPxCheckBox ID="cbEnabled" Checked="True" runat="server" Text="Enabled">
                 <ClientSideEvents CheckedChanged="function(s, e) {
    myMenu.GetItem(0).SetEnabled(s.GetChecked());
 }" />
             </dxe:ASPxCheckBox></td>
         </tr><tr>
             <td><dxe:ASPxCheckBox ID="cbChecked" Checked="False" runat="server" Text="Checked">
                 <ClientSideEvents CheckedChanged="function(s, e) {
    myMenu.GetItem(0).SetChecked(s.GetChecked());
 }" />
             </dxe:ASPxCheckBox></td>
         </tr><tr>
             <td><dxe:ASPxButton ID="bText" runat="server" Text="SetText()" AutoPostBack="False">
                 <ClientSideEvents Click="function(s, e) {
    myMenu.GetItem(0).SetText('Text is changed');
 }" />
             </dxe:ASPxButton></td>
         </tr><tr>
             <td><dxe:ASPxButton ID="bNavigateUrl" runat="server" 
            Text="SetNavigateUrl()" AutoPostBack="False">
                 <ClientSideEvents Click="function(s, e) {
    myMenu.GetItem(0).SetNavigateUrl('http://www.google.com');
 }" />
             </dxe:ASPxButton></td>
         </tr><tr>
             <td><dxe:ASPxButton ID="bImageUrl" runat="server" 
            Text="SetImageUrl()" AutoPostBack="False">
                 <ClientSideEvents Click="function(s, e) {
    myMenu.GetItem(0).SetImageUrl('Images/UserSelected.gif');
 }" />
             </dxe:ASPxButton></td>
         </tr></table>
         <br/>
         <dxm:ASPxMenu ID="ASPxMenu1" runat="server" ClientInstanceName="myMenu" 
          ItemImagePosition="Top">
             <Items>
                 <dxm:MenuItem Text="Menu Item" GroupName="SingleGroup" 
                      NavigateUrl='http://www.yahoo.com'>
                     <Image Url="Images/User.gif" 
                    UrlDisabled="../Images/Images/UserDisabled.gif" />
                 </dxm:MenuItem>
                 <dxm:MenuItem Text="Menu Item">
                     <Image Url="Images/User.gif" />
                 </dxm:MenuItem>
             </Items>
         </dxm:ASPxMenu>
     </div>
     </form>
 </body>
 </html>
See Also