Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • phenryll 28 posts 53 karma points
    Jan 20, 2011 @ 14:42
    phenryll
    0

    Accessing Page's Code Behind: implement an interface to the Page Class

    A couple of days ago I was reading a book related to Design Patterns in ASP.NET (Professional ASP.NET Design Patterns by Scott Millett).

    S. Millet describes the MVP pattern that can be applied to Webforms. The Page must implement an interface called IView. The Page has the responsability to instantiate the presenter.

    I am interested in using the MVP Pattern in Umbraco. I do need to access the Page's Code Behind to implement the interface. I can live without it by handling any event like Page_Load within a script block. But doing this is like cheating as implementing an interface forces the page to conform to a contract/interface.

    The only way to have more control over the Page-like is to use UserControl as it is the manual way to do things.

    Any idea?

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Jan 20, 2011 @ 15:54
    Ismail Mayat
    0

    Aaron powell did a session about unit testing umbraco and using mvp see http://www.aaron-powell.com/unit-testing-with-umbraco im sure there is a video to the session somewhere.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Jan 20, 2011 @ 16:06
  • phenryll 28 posts 53 karma points
    Jan 20, 2011 @ 17:25
    phenryll
    0

     

    Thanks guys.

    To sum up what I have watched, Aaron used the MVP Framework and implemented the IView to a UserControl. As I said using UserControl in Umbraco is the only manual way to fiddle with code. He didn't implement the IVIew to the Page. It seems there is no way to implement an interface directly at the Page level.

    If the topic is of interest to you I recommend you read S. Millet's step-by-step implementation of the MVP Pattern (Professional ASP.NET Design Patterns by Scott Millett). MVP makes Webforms much more interesting.

     

Please Sign in or register to post replies

Write your reply to:

Draft