Sunday, December 26, 2010

Setting NavigateUrl property will not set the menu item as selected

If NavigateUrl is set for a menu item, when users select this menu item, the menu item will not be set as selected menu item. The only exception is when the menu item data are populated from site map. In all other case, ASP.Net will not set the selected menu item for the application.
The workaround is getting the aspx file name from request's physical path, and then matching the file name to the corresponding menu item, and then programatically set the matched menu item to be selected.
The issue can be repeated by setting a static menu collection in master page, and then navigate to some content page by click a menu item.

Jonathan

No comments:

Post a Comment