Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Saicharan Kalyan Reddy Marapareddygari 3 posts 73 karma points
    Jul 09, 2024 @ 11:56
    Saicharan Kalyan Reddy Marapareddygari
    0

    Making Umbraco Block Grid readonly or hiding it in SendingContentNotification

    Hi,

    I am pretty new to the Block grid and lists, and I encountered an issue when working with it.

    I have Block grid property which I wanna hide for some user groups, I tried same hack that I have been doing forever ( removing the property in Content Sending Event ) but this results in error when saving the content.

    enter image description here

    Can anyone please help me regarding this? Making the property readonly results in same error as well

    This is how I am hiding the property :

       var firstVariant = notification.Content.Variants.FirstOrDefault();
    
       if (firstVariant is not null )    
       firstVariant.Tabs.First(x => !String.IsNullOrEmpty(x.Alias) && x.Alias.Equals("gridContent/properties")).Properties = firstVariant.Tabs.First(x => !String.IsNullOrEmpty(x.Alias) && x.Alias.Equals("gridContent/properties")).Properties.Where(x => !x.Alias.Equals("content"));
    
Please Sign in or register to post replies

Write your reply to:

Draft