This post originated from an RSS feed registered with .NET Buzz
by Anand M.
Original Post: ASP.NET 2 Menu Control Gotcha
Feed Title: .NET From India
Feed URL: http://www.dotnetindia.com/index.rss
Feed Description: Your daily dose of .NET From India
ASP.NET 2.0 boasts of a new Menu control. You can create multi-level menus using this. It is not the best, but is decent enough to satisfy most common needs.
One thing that I had a problem with recently, is that if you have a multi-level menu, clicking a parent will result in a postback to the server. This was not a problem, till we decided we would improve the performance by turning viewstate off for controls that did not need them. Now suddenly, when you click the top level item, certain controls in the current screen will lose state.
The way out is to set the selectable property of items that is not mapped to an action. This way not only do we avoid unwanted postback, but also get around a need to have unwanted viewstate.