Controlling items visibility in menu control

Discussion in 'ASP .Net Web Controls' started by Vipper, Jun 26, 2007.

  1. Vipper

    Vipper Guest

    Hi,

    I'd like to control the item visibility of a menu control, but I cannot find
    the visibility property of the item.
    The idea is like this:

    if [...]
    mnuOptions.items(1).visible = false
    end if

    Is it possible?

    Thanks
     
    Vipper, Jun 26, 2007
    #1
    1. Advertising

  2. Vipper

    Vipper Guest

    Thanks David. It's exactly what i need.


    "David R. Longnecker" wrote:

    > I believe the syntax you are looking for is Menu.Items.RemoveAt(int). Here's
    > an example of both greying out an item and removing it from the collection
    > (ala Hiding it).
    >
    > Menu1.Items.Add(new MenuItem("Menu #1", "", "", "~/default.aspx",
    > "_parent")); // [0]
    > Menu1.Items.Add(new MenuItem("Menu #2", "", "", "~/default.aspx",
    > "_parent")); // [1]
    > Menu1.Items.Add(new MenuItem("Menu #3", "", "", "~/default.aspx",
    > "_parent")); // [2]
    > Menu1.Items.Add(new MenuItem("Menu #4", "", "", "~/default.aspx",
    > "_parent")); // [3]
    > Menu1.Items.Add(new MenuItem("Menu #5", "", "", "~/default.aspx",
    > "_parent")); // [4]
    >
    > Menu1.Items[1].Enabled = false; // Greys out Menu #2.
    >
    > Menu1.Items.RemoveAt(2); // Removes Menu #3 from the MenuItemCollection
    >
    > I'm assuming the VB syntax would be the same, just without the semi-colons
    > for the RemoveAt.
    >
    > if [...]
    >
    > mnuOptions.Items.RemoveAt(1)
    >
    > end if.
    >
    > etc.
    >
    > HTH.
    >
    > -dl
    >
    > --
    > David R. Longnecker
    > http://blog.tiredstudent.com
    >
    > V> Hi,
    > V>
    > V> I'd like to control the item visibility of a menu control, but I
    > V> cannot find
    > V> the visibility property of the item.
    > V> The idea is like this:
    > V> if [...]
    > V> mnuOptions.items(1).visible = false
    > V> end if
    > V> Is it possible?
    > V>
    > V> Thanks
    > V>
    >
    >
    >
     
    Vipper, Jun 27, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWFubnkgQ2hvaGFu?=

    Problem with controlling visibility of linkbutton

    =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Apr 5, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    426
    Eliyahu Goldin
    Apr 5, 2005
  2. Bryan
    Replies:
    1
    Views:
    783
    Steven Cheng[MSFT]
    Mar 1, 2006
  3. Larry Bud
    Replies:
    13
    Views:
    7,705
    Larry Bud
    Jan 7, 2008
  4. Mike Tavares

    Adding Access keys to menu items in the Menu control

    Mike Tavares, Dec 23, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    420
  5. Philip
    Replies:
    1
    Views:
    323
Loading...

Share This Page