We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Null exception in SfRadioButton when checked status set by Parameter


When I set the Checked value of a SfRadioButton from a parent component I get the exception from the builder:
"System.NullReferenceException: 'Object reference not set to an instance of an object."

The following code is your own example but with stringChecked set via Parameter.

Thanks, Bruno​

<SfRadioButton Label="Option 1" Name="options" Value="card" @bind-Checked="stringChecked"></SfRadioButton> <SfRadioButton Label="Option 2" Name="options" Value="cash" @bind-Checked="stringChecked"></SfRadioButton>
@code {
  public string stringChecked { get; set; } = "check2";

Parent component:
<TestComponent stringChecked="card" />

2 Replies

BR Bruno February 7, 2023 08:44 AM UTC

Sorry, it was my fault, a beginner's fault!

I called TestComponent multible time for several parameters.
Obviously thats not legal.

<TestComponent stringChecked="card" />
<TestComponent anotherChecked="check1" />  //>> not null exception in the tree builder

Regards, Bruno

YA YuvanShankar Arunagiri Syncfusion Team February 7, 2023 11:08 AM UTC

It okay, Bruno. Please let us know if you need any other assistance.

Live Chat Icon For mobile
Up arrow icon