0

Ok So i have written methods to override the LoadPageStateFromPersistenceMedium and SavePageStateToPersistenceMedium methods. now the problem is that i am using a masterpage, so how do i maintain using my masterpage and still inherit from System.Web.UI.Page?

Please bear in mind that the .vb Code behind the masterpage already inherits System.Web.UI.MasterPage. Anybody know how i can "properly" override these methods in a MasterPage?

moonblade
  • 287
  • 1
  • 3
  • 13

1 Answers1

0

You don't override those in the master page. It's still the Page object that is the main object for the page, the master page is actually just a user control in the page.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • ok fair enough. so how will i make use of my methods then? the methods i wrote override the ones from page, now how does my page call these? because with a break point on those specific methods, it seems they aren't getting called, and my viewstate is present on the page source – moonblade Sep 15 '09 at 08:11
  • If you are using framework 1 that should work. If you are using framework 2 or later you haven't actually overridden the methods, as they are internal so they can't be overridden. To do this you instead create a class that inherit from PageStatePersister. Example: http://msdn.microsoft.com/en-us/library/system.web.ui.pagestatepersister%28VS.80%29.aspx – Guffa Sep 15 '09 at 08:23
  • using .Net 2.0 so i guess that means i must use PageStatePersister. will try that and report back on my results – moonblade Sep 15 '09 at 08:26
  • thank you, using PageStatePersister as a page adapter i got pretty much what i wanted. – moonblade Sep 15 '09 at 08:40