Radio Button Does Not Update with Value from Microsoft SQL Server Database

Hello Syncfusion, I created a radio button that takes a bit of 1 or 0 as the data type in my database. However, when I save, the values of the radio button, they are saved successfully to the database. However, on edit, the corresponding value of true or false is not checked on my Edit form. Both the Yes and No fields remain unchecked yet one of them is supposed to be checked for either Yes or No. How can I achieve this ? I am using ASP.NET MVC - Javascript Radio Button for Syncfusion.


My Fields are:

<td style="text-align: left">Breast Feeding</td>

                                    <td>

                                        <input type="radio" name="small1" id="BreastFeeding1" class="FeedingButton"/><label for="BreastFeeding">Yes</label>

                                    </td>

                                    <td>

                                        <input type="radio" name="small1" id="BreastFeeding2" class="FeedingButton" /><label for="BreastFeeding" >No</label>

                                    </td>

My Javascript Declarations are:

$("#BreastFeeding1").ejRadioButton({

                size: "medium",

                value:true

            });

 $("#BreastFeeding2").ejRadioButton({

                size: "medium",

                value: false

            });

I have attached my cshtml page for review and a sample video of what happens:



Attachment: RadioButtonError_be661099.rar

2 Replies

IB IBS August 23, 2022 08:35 AM UTC

To Clarify: I made a mistake; This is in ej1 not ej2. Please take note



SS Sivakumar ShunmugaSundaram Syncfusion Team August 25, 2022 01:40 PM UTC

Hi IBS,


Greetings from Syncfusion support.


As per the shared details, we understand that you are facing an issue with RadioButton control while editing the form. But we are quite unclear about the exact code details in the SadrrPatientsControl.cs file. From the shared video, we understand that the checked value of the radio button will be properly in the SadrrPatientsControl.cs file.


However, if you want to keep the radio button value, you must save and upload the button details when you click the save button, and when you edit the form, you must return the RadioButton checked state value and append it to the RadioButton control. So, we suggest you confirm whether you have saved the RadioButton state value in the SadrrPatientsControl.cs file and append the value while editing the form.


Please confirm the above details. If the issue still persists from your side, share the complete RadioButton code details in the SadrrPatientsControl.cs file. It will help us to provide a prompt solution.


Regards,

Sivakumar S


Loader.
Up arrow icon