asp.net mvc - Orchard Custom Module Shared Directory -


the orchard implementation of mvc view engine doesn't seem find views or partial views in "shared" directory, default view engine does.

so, if in cshtml refer partial view like:

@html.partial("viewfromshared") 

this fail in custom orchard module (but work in normal asp .net website).

how can go making orchard view engine search shared directory?

also, there way of making orchard recognize viewstart page?

thank you.

update:

i can follow exact steps below reproduce:

  • create new asp .net mvc 4 project (myapp).
  • add new cshtml in shared directory (sharedfile.cshtml).
  • add new view (views/xyz/myview) , controller (controllers/xyzcontroller).
  • call view("myview") new controller index method.
  • add html.partial("sharedfile") myview
  • publish website orchard/modules/myapp.
  • add module.txt (name: myapp)
  • add irouteprovider , following routedescriptor

    new routedescriptor         {             priority = 5,             route = new route(                 "modules/myapp/{controller}/{action}",                 new routevaluedictionary                     {                         {"area", "myapp"}                     },                 new routevaluedictionary(),                 new routevaluedictionary                     {                         {"area", "myapp"}                     },                 new mvcroutehandler())         }, 
  • go myorchardsite/modules/myapp/xyz/index in browser.

  • viewfromshared not found , throws exception:

expected result: viewfromshared should render on page

  • if remove call @html.partial("viewfromshared") _viewstart.cshtml , _layout.cshtml not respected , there no html/head/body tags...just content of myview.cshtml.

expected result: should have _viewstart.cshtml , _layout.cshtml rendered in page.

you can use @display.viewfromshared() create shape on fly , make render in place. can set properties on shape if need to, using syntax such @display.viewfromshared(someproperty: val, someotherproperty: 42). see https://weblogs.asp.net/bleroy/creating-shapes-on-the-fly more details on creating shapes on fly.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -