|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
Can you please give me a hint how I can get the eo:Menu control to work when I disable the viewstate on a page. I raise a server event. In the event I use the menu_item_id to look up the page I need to redirect to and do the redirect. Everything works fine. However, I have a page that does not use the viewstate, is extremely dynamic in nature and causes random viewstate errors. Disabling the viewstate fixes everything. However, from the page with the disabled viewstate, when I select a menu option, it does not postback to my event handler, in fact the entire menu control appears to crash as my menu is no longer displayed and the page is just re-displayed. Is there a behavior that I should follow using the menu control with the viewstate disabled?
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
When disabling the viewstate on the menu control directly, it no longer works at all. I find that somewhat ironic because EO recommends doing this to increase performance. Any advice would be very much appreciated. Am I missing a property or configuration? Thanks in advance.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
We are not aware of any crash that would occur when view state is disabled. When view state is disabled, you will not be able to get server event on dynamically created items because the Menu relies on data saved in view state to re-construct all the items that you previously dynamically created with code. When it could not re-construct the menu items because there is no view state data saved, it would not be able to trigger server event for that menu item. As such if you disable view state, you will probably want to use a static menu with only navigational features (by setting each menu item's NavigateUrl). If you dynamically create the menu, you will need to recreate the menu again yourself exactly the same way when the page is posted back as you did when the page was initially rendered. So you either let the menu + view state data to reconstruct the menu for you, or you do it yourself.
It is not uncommon to have a crash when you have a mismatched view state data. For example, if when the page was initially rendered there was a button called "Button1" which saved some view state data, but when the page posts back your page actually have a Menu called "Button1", then the menu will try to decode and load view state data previously saved by the Button. In this case it is not possible for the menu to bullet proof itself not to crash no matter what data was feed to it, as such to fix such crashes you will want to fix the mismatch first.
If you think the problem is something else, you can try to post a sample page and we will look further.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
Interesting response. I did create a greatly simplified project that almost exactly emulates what I am doing in my very large project. I was hoping to get the menu control to disappear in the simplified project. I build the menu with each post back in the OnInit event of the Master Page. So creating the menus dynamically (programatically) is no problem. The simple problem is the menu event handler is never being called when the menu option is selected and viewstate is disabled on the menu control. In my simplified project it is calling the event handler. I am using the exact same classes to construct the menu and handle the menu events between the two projects. One works, one fails. So you have no idea what would prevent the handler from being called?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
Please check whether your Menu's RaisesServerEvent is set to true. If that property is not set to true, clicking an menu item won't post back the page at all.
Thanks!
|
|