2

I have upgraded my Sitecore instance instance from Sitecore 8.2 to Sitecore 9.3

I am getting below errors in experience editor mode but in normal mode component is not showing because we added error handling pipelines for view and controller rendering.

enter image description here

Error in Text

Inner Exception Failed to find ID. Ensure that you have an ID property on your model.
 at Glass.Mapper.Sc.GlassHtml.EditFrame[T](T model, String title, TextWriter output, Expression`1[] fields) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\GlassHtml.cs:line 199

    at Glass.Mapper.Sc.Web.Mvc.GlassView`1.BeginEditFrame[T](T model, String title, Expression`1[] fields) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc.Mvc\Web\Mvc\GlassView.cs:line 296 
    at ASP._Page_Areas_Clinical_Views_Listing_L05B_ListingProvidersWithTabs_cshtml.Execute() in c:\inetpub\wwwroot\local-cm.atriumhealth.org\Areas\Clinical\Views\Listing\L05B-ListingProvidersWithTabs.cshtml:line 20 
    at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() 
    at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() 
    at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) 
    at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) 
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) 
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) 
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) 
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) 
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)

My Code is

 public class TestViewModel
    {
        /// <summary>
        /// Gets or sets the id
        /// </summary>
        [SitecoreId]
        public Guid Id { get; set; }

       }

1 Answer 1

4

I have face same problem in my project, after some investigation I found that Glass Mapper properties needs to be virtual, so try below code and let me know if it's works for you or not.

 public class TestViewModel
   {
       /// <summary>
       /// Gets or sets the id
       /// </summary>
       [SitecoreId]
       public virtual Guid Id { get; set; }

      }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.