How to lock radzen grid column on button switch?

Hi, i have a radzen grid with a few columns and a radzenswitch button.

<div> <RadzenSwitch Style="margin-bottom: 20px" /> </div>
            <RadzenGrid @ref="usersGrid" AllowFiltering="false" FilterCaseSensitivity="Radzen.FilterCaseSensitivity.CaseInsensitive"
                        AllowPaging="true" AllowSorting="false" Data="@usersData" TItem="Users"
                        ColumnWidth="100px" PageSize="30">
                <Columns>
                    <RadzenGridColumn TItem="Users" Property="Name" Title="Name" />
                    <RadzenGridColumn TItem="Users" Property="Email" Title="Email" />
                    <RadzenGridColumn TItem="Users" Property="IsSubscribed" Title="Is Subscribed?">
                        <Template Context="user">
                            <RadzenCheckBox @bind-Value="user.IsSubscribed" TValue="bool?" Change=@(args => OnSubscribeChange(user)) />
                        </Template>
                    </RadzenGridColumn>
                </Columns>

            </RadzenGrid>

I was wondering if there was a way to make the radzengridcolumn 'IsSubscribed' column grey out? or unable to be edited if I click on the switch button?
I want to bind the switch onto that specific column and if it is on, means that users can edit it all they like and if it is off, they cannot edit it.

Thank you in advance!

What does "grey out" mean? Or "unable to be edited"?

Hi korchev,

Sorry if my explanation wasnt clear, if you can see my radzengridcolumn with property, isSubscribed.

<RadzenGridColumn TItem="Users" Property="IsSubscribed" Title="Is Subscribed?">

I use the template context and radzencheckbox inside this one.

<Template Context="user">
                            <RadzenCheckBox @bind-Value="user.IsSubscribed" TValue="bool?" Change=@(args => OnSubscribeChange(user)) />
                        </Template>

With the code alone like this, the user can click on the checkbox to mark the value to be true or not.
I wanted to know if I can disable the template context so the user cannot change the value?
I hope that makes more sense?

Do you want to disable the RadzenCheckBox in the template? If yes - set its Disabled property.

<RadzenCheckBox Disabled="isDisabled" @bind-Value="user.IsSubscribed" TValue="bool?" Change=@(args => OnSubscribeChange(user)) />

Could I change the background colour of the column if the disabled property is true?

You can if you use the CellRender event.

Hi @korchev,

I'm using the cell render property inside my radzen grid:

CellRender="@ColumnRender"

With my function:

void ColumnRender(CellRenderEventArgs<ServiceDTO> args) 
{
if (!args.Data.IsSubscribed)
                {
                    args.Attributes.Add("style", $"background-color: red");
                }
}

I'm trying to change the colour of the whole column to red not the row, how I can change my code to target the column instead? Thanks!

I am not sure what this means.

With the code above, when a user is not subscribed, the row changes colour to red.
I dont want the row to change colour, I want the column "IsSubscribed" to change colour.
Hope that makes more sense

Then add an additional check for the right column. Check args.Column.Property for example.