ASPMenu

G

Guest

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.
 
G

Guest

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top