bind-Checked only work one way

I can't read the checkedValue of the radiobutton, also ValueChange do not work.

Unbenannt.png


I append also a simple  testproject. How can read the checked value ?


Attachment: BlazorProject_4fb94c40.zip

6 Replies

YA YuvanShankar Arunagiri Syncfusion Team October 3, 2022 05:31 AM UTC

Hi Michael,


We have validated your reported query and prepared the sample based on your requirement. please refer the below code snippet and attached sample. we need to set TChecked property for radio button two-way bind-checked feature.

<SfRadioButton Label="Unspecified" Name="status" TChecked="string" Value="Unspecified" @bind-Checked="@CheckedValue" CssClass="e-primary" ValueChange="OnValueChange"></SfRadioButton>

……………………………………………………………

private void OnValueChange(ChangeArgs<string> args)

    {

        var Selected_item = args.Value;

    }


Could you please check the above code and get back to us, if you need any further assistance on this.

  

Regards, 

YuvanShankar A


Attachment: SyncfusionBlazorApp_f5b11209.zip


MM Michael Meier October 3, 2022 09:48 AM UTC

OnValueChange ist never called and the 2 way binding also not work. Here my complete sample:


Attachment: SyncfusionBlazorApp_d4903db5.zip


MM Michael Meier October 3, 2022 09:56 AM UTC

Sorry your sample WORK !

 I have to find out what's the difference to my sample code maybe because I also have an OnClicked handler which I dont need if OnValueChange work,

Thanks YuvanShankar  m you can close it. Problem solved.

I have another problem with  SfRadiobutton, I must override the css because my radio buttons are placed on a dark background and the default label color (text) is black, that css code is already in my sample. But with that the disable state don't work anymore. Do you know what I have to do in css to have the label color (text) gray or more opaque if the radiobutton have:

<SfRadioButton Label="Dismissed" Name="status" TChecked="string" Value="Dismissed" @bind-Checked="@CheckedValue" CssClass="e-primary" ValueChange="OnValueChange" Disabled="true" ></SfRadioButton>

 



YA YuvanShankar Arunagiri Syncfusion Team October 4, 2022 12:31 PM UTC

Hi Michael,


We have checked your reported query and please use the below CSS code to achieve your requirement.

.e-radio:disabled + label .e-label {

        color: gray !important;

    }


Please get back to us if you need further assistance on this.


Regards,

Yuvan Shankar A


Attachment: Index_cc6e93de.zip


MM Michael Meier October 4, 2022 01:45 PM UTC

That solved it ! Great thanks.



YA YuvanShankar Arunagiri Syncfusion Team October 5, 2022 04:34 AM UTC

You are welcome, Michael. We are happy to hear that your requirement has been fulfilled. Please get back to us if you need any further assistance on this.


Loader.
Up arrow icon