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

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -