c# - Passing Glass Model in sitecore view rendering -
we have 2 glass views inherited different glass models, both working great individually.
now, want insert 1 view another. tried using code below:
var model = new sitecorecontext().getitem<iourglassmodel>(path); if (model != null) { @html.sitecore().viewrendering("/views/path/banner.cshtml", new { model = model }) }
this ended below error message:
server error in '/' application. not locate item containing model definition. model path: castle.proxies.iourglassmodelproxy_1
let me know if need full stack trace.
any suggestions appreciated.
use insted:
@html.partial("/views/path/banner.cshtml", model)
the point @html.sitecore().viewrendering re-invoke sitecore pipelines , render component begging. on other side, using @html.partial render partial view using same execution.
check question more details difference between 2 methods: sitecore view rendering , controller rendering helper
Comments
Post a Comment