sitecore - Model has value even when null is passed to view through controller -
i using glass mapper mapping sitecore item class objects.
in 1 of module when pass null view, model still has value. seems inheriting page properties. below screenshots.
screen shot 1: passing null value view
screen shot 2: model in view still has value
below code related_content generated tds:
/// <summary> /// related_content /// <para></para> /// <para>path: /sitecore/templates/user defined/pokercentral/component templates/data templates/callouts/related content</para> /// <para>id: 2b54f9fd-1fb5-4638-98b0-0acd420c5b81</para> /// </summary> [sitecoretype(templateid=irelated_contentconstants.templateidstring)] //, cachable = true public partial class related_content : glassbase, irelated_content { /// <summary> /// item listing field. /// <para></para> /// <para>field type: treelist</para> /// <para>field id: 7a77a177-c5e0-4f74-9235-c5c6b709f7a0</para> /// <para>custom data: </para> /// </summary> [global::system.codedom.compiler.generatedcodeattribute("team development sitecore - glassitem.tt", "1.0")] [sitecorefield(irelated_contentconstants.item_listingsfieldname)] public virtual ienumerable<guid> item_listings {get; set;} /// <summary> /// title field. /// <para></para> /// <para>field type: single-line text</para> /// <para>field id: 5abe46db-487c-4f1b-8a3c-d3e0ed515d9c</para> /// <para>custom data: </para> /// </summary> [global::system.codedom.compiler.generatedcodeattribute("team development sitecore - glassitem.tt", "1.0")] [sitecorefield(irelated_contentconstants.titlefieldname)] public virtual string title {get; set;} /// <summary> /// base category field. /// <para></para> /// <para>field type: droplink</para> /// <para>field id: 1cb2b0a4-f7e7-4cbe-b49b-7d660106365a</para> /// <para>custom data: </para> /// </summary> [global::system.codedom.compiler.generatedcodeattribute("team development sitecore - glassitem.tt", "1.0")] [sitecorefield(irelated_contentconstants.base_categoryfieldname)] public virtual guid base_category {get; set;} /// <summary> /// base tags field. /// <para></para> /// <para>field type: multilist search</para> /// <para>field id: 072c54de-8fde-47f8-aaa0-2b0b1bd8843b</para> /// <para>custom data: </para> /// </summary> [global::system.codedom.compiler.generatedcodeattribute("team development sitecore - glassitem.tt", "1.0")] [sitecorefield(irelated_contentconstants.base_tagsfieldname)] public virtual ienumerable<guid> base_tags {get; set;} }
can let me know how can fix this?
you inheriting glassview<related_content>
glass loads model automatically if rendering on context item.
if want pass model controller don't inherit glass view instead use @model related_content
by looking @ code, passing data source view. if inheriting glass view, loads data source model.
Comments
Post a Comment