Inherited Razor View - how to run an initializer method?

I've created an abstract class that inherits from WebPageView

public abstract class TemplateEngine<TModel> : WebViewPage<TModel> {

When my view renders, I execute some initializer code - for e.g.


I'd ideally like to avoid this and somehow execute it within the class, a method that Razor calls when it's about to render the view, so that all inherited view pages don't need me to write this line.

I tried overriding Execute() and it never gets called.

Any ideas?



You can override the InitializePage method.

public abstract class TemplateEngine<TModel> : WebViewPage<TModel> 
    protected override void InitializePage()

Need Your Help

Returning ajax response from django

javascript jquery ajax django

I have exhausted my brain trying to get something simple to work. I want to change the behavior of a form from post reload to ajax with django. I just can't get it to work.

ironPython - python socket file transfer, typeError

python sockets ironpython typeerror file-transfer

I'm trying to send a binary file from a client that runs on ironPython 2.7.4 to a server that runs on cpython 2.7.6 on a linuxbox. I followed this example, however when the server starts writing th...