I can't place a disabled SfnumericTextbox at runtime

Good afternoon team, I am trying to enable and disable a SfNumeric Textbox at runtime depending on a Radio button, but it doesn't do it, I set the property Enabled = false in the code but it doesn't disable it.


<SfRadioButton Label="Bank Name" Name="searchBank" Value="BankName" @onchange="ChangeSearchBank" Checked="@checkedValue"></SfRadioButton>

<SfRadioButton Label="Bank Code" Name="searchBank" Value="BankCode" @onchange="ChangeSearchBank" Checked="@checkedValue"></SfRadioButton>

private string checkedValue = "BankName";

 public void ChangeSearchBank(Microsoft.AspNetCore.Components.ChangeEventArgs args)

 {

     checkedValue = (string)args.Value;


     if (checkedValue == "BankName")

     {

         ddlBanks.Enabled = true;

         txtBankCode.Enabled = false;

     }

     else

     {

         ddlBanks.Enabled = false;

         txtBankCode.Enabled = true;

     }

     StateHasChanged();

 }


1 Reply

KP Kokila Poovendran Syncfusion Team March 14, 2024 07:06 AM UTC

Hi Cristian Tascon,


Thank you for reaching out to us.


We understand that you're encountering difficulties with dynamically enabling and disabling a SfNumericTextBox based on a radio button selection. We've thoroughly reviewed your query and created a simple sample to address your concern.


Please take a look at the sample here: https://blazorplayground.syncfusion.com/BXLftKizVfwhBQcx


In this sample, we've showcased how to disable the component upon clicking the radio button. Please feel free to modify this sample to better replicate your scenario. Additionally, if you could provide a video illustration of the issue you're facing, it would greatly assist us in understanding the problem accurately and providing a tailored solution.


We're committed to ensuring that you receive the assistance you need, and we appreciate your patience and cooperation in resolving this matter.



Regards,
Kokila Poovendran.


Loader.
Up arrow icon