Enable/Disable Textboxes

I am trying to enable/disable radzen textboxes based on selected radio button value but facing some difculties

RadzenTextBox Style="display:block; width:80%" Disabled="(value == 1 ? true : false)"

public bool DisableField = false;

void OnChange(int value)
{
DisableField = (value == 1 ? true : false);
InvokeAsync(StateHasChanged);
}

RadzenTextBox Style="display:block; width:80%" Disabled="DisabledField"

should work

1 Like

@Vinod_Pillai
I really appreciate your time and suggestions, textbox is now getting enable/disable but not showing changes live. I mean I have to go to another page and then need to come back again then I can see the result.
Any suggestions for this issue ?

Please share your razor and cs code to understand and advise further.

Thanks @Vinod_Pillai .

Here's my code.

designing

 <RadzenRadioButtonList @bind-Value=@value TValue="int" Change=@((args) => OnChange(args)) >
                    <Items>
                        <RadzenRadioButtonListItem Text="main" Value="1" Style="padding-left:100px" />
                        <RadzenRadioButtonListItem Text="other" Value="2" Style="padding-left:200px" />
                    </Items>
                </RadzenRadioButtonList>

Form designing

<RadzenTextBox Style="display:block; width:80%" Disabled="DisableField" @bind-Value=AddressData.otherAddress Name="RemitTo" />

code

public bool DisableField = false;

void OnChange(int value)
{
DisableField = (value == 1 ? true : false);
InvokeAsync(StateHasChanged);
}

enabling and disabling textbox is working but for that I have to visit another tab or page and come back again to that part then and only then I can see whether it is enabled or disabled.