MVC and Umbraco integration

后端 未结 4 1009
甜味超标
甜味超标 2021-02-01 11:45

I\'ve followed the steps from http://memoryleak.me.uk/2009/04/umbraco-and-aspnet-mvc.html and integrated MVC in Umbraco with success, but I still have a problem which is critica

4条回答
  •  伪装坚强ぢ
    2021-02-01 12:39

    Rather than trying to use the Umbraco controls, you might consider writing some HtmlHelper extension methods that use the umbraco.NodeFactory.Node class to obtain the content you're trying to display in your views. Writing methods that mimic (or simplify based on your needs) umbraco.presentation.templateControls.Item and umbraco.presentation.templateControls.Macro may be enough for you.

    EDIT

    I went down this path with some success. I also took a look at the MVC source to find out how partial views were being added to the underlying web forms controls collection. I ended up writing a class that inherits from the umbraco.presentation.templateControls.Macro class that looks a lot like the System.Web.Mvc.ViewUserControl class.

提交回复
热议问题