ASPMenu

Discussion in 'ASP .Net' started by =?Utf-8?B?KioqKiBLaXRlT3JlZ29uICoqKio=?=, Jan 28, 2007.

  1. I have a page with an aspMenu, i am able to handle the menuItem_click event,
    however once i handle the event how do i make the page navigate?

    so how do i make the aspMenu control navigate to a URL set in the
    codebehind. I can't use the normal click event. In this case i want to use
    the control, but it's visibility property could be set to false, so how do i
    do the same thing.

    This is confusing, maybe better if i could write code to explain what i want.

    MenuItem myItem = new MenuItem;
    myItem.NavigateURL = "http://www.url.com";
    myItme.Target = "content";

    Menu1.Items.Add(myItem)

    ** now i want to call a nav function. **
    ie. Menu1.Items["X"].act_like_i_was_clicked_from_client


    ok, i think that makes a little more sense.

    Thanks

    Eric.
    --
    Just another lost developer.....
    =?Utf-8?B?KioqKiBLaXRlT3JlZ29uICoqKio=?=, Jan 28, 2007
    #1
    1. Advertising

  2. Howdy,

    If i got you right, you want to achieve something like this:

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    menu.Items.Add(new MenuItem("Go to MST", "http://www.microsoft.com"));
    menu.Items.Add(new MenuItem("Go to Amazon", "http://www.amazon.com"));
    }
    }
    protected void menu_MenuItemClick(object sender, MenuEventArgs e)
    {
    // do something before redirecting ...
    // i.e. increase link target website counter
    // and redirect
    Response.Redirect(e.Item.Value);
    }

    Remember viewstate of the page/menu has to be enabled

    hope this helps
    --
    Milosz


    "**** KiteOregon ****" wrote:

    > I have a page with an aspMenu, i am able to handle the menuItem_click event,
    > however once i handle the event how do i make the page navigate?
    >
    > so how do i make the aspMenu control navigate to a URL set in the
    > codebehind. I can't use the normal click event. In this case i want to use
    > the control, but it's visibility property could be set to false, so how do i
    > do the same thing.
    >
    > This is confusing, maybe better if i could write code to explain what i want.
    >
    > MenuItem myItem = new MenuItem;
    > myItem.NavigateURL = "http://www.url.com";
    > myItme.Target = "content";
    >
    > Menu1.Items.Add(myItem)
    >
    > ** now i want to call a nav function. **
    > ie. Menu1.Items["X"].act_like_i_was_clicked_from_client
    >
    >
    > ok, i think that makes a little more sense.
    >
    > Thanks
    >
    > Eric.
    > --
    > Just another lost developer.....
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=, Jan 29, 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?cGlja2VkYW5hbWU=?=

    aspmenu require click to activate

    =?Utf-8?B?cGlja2VkYW5hbWU=?=, Mar 5, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    684
    =?Utf-8?B?cGlja2VkYW5hbWU=?=
    Mar 6, 2007
  2. Vijay

    AspMenu - Multiple Separator Images?

    Vijay, Aug 11, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    432
    Vijay
    Aug 11, 2006
Loading...

Share This Page