[Mono-dev] [PATCH] System.Web.Menu ViewState

Konstantin Triger kostat at mainsoft.com
Mon Jun 26 14:05:07 EDT 2006


Hello,

 

Currently the databound menu view state is not correctly saved, thus on postback, it is not restored since the binding does not happen.

This happens because of several reasons:

1.	MenuItemCollection saves dirty items only if it's a) populated b) marked for saving state c) altered. And it will save only items, which were added during first load. I changed it to simply save items if the collection is dirty (marked for saving state and then altered), please review this part.
2.	MenuItem did not bind the items recursively during its binding phase. So the inner items were lazily bound during render. At this point, the view state is already prepared, so it did not contain inner item data. In addition the menu caption was not retrieved, so it did not make to the view state.
3.	Menu first bound the MenuItem and than added to the collection. Since the item dirty state is set in MenuItemCollection.Add if the collection tracks its view state; and during binding we set the collection view state tracking according to the item view state tracking, Add() should be called prior to Bind.

 

Attached a patch fixing this. Please review.

 

Regards,

Konstantin Triger

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060626/b9c182a0/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: menus.patch
Type: application/octet-stream
Size: 3452 bytes
Desc: menus.patch
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060626/b9c182a0/attachment.obj 


More information about the Mono-devel-list mailing list