Hi team
I want to create a radio button that will once clicked do the check, when a user click on a radio button the value selected be saved on a database record. Does anyone ever worked on this on asp.net mvc 5 and javascript?
Hi team
I want to create a radio button that will once clicked do the check, when a user click on a radio button the value selected be saved on a database record. Does anyone ever worked on this on asp.net mvc 5 and javascript?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Nov 26, 2021, 7:53 AM
Guest UserPosted Nov 26, 2021, 7:15 AM
Sachin
This is what i have done so far, somehow the button does not save selected value to the db record. What am i missing?
// View
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
Application CheckList
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
PLC_Marshal
@Html.RadioButtonFor(model => model.Application_Check, "PLC_Marshal")
BVMS_PMON
@Html.RadioButtonFor(model => model.Application_Check, "BVMS_PMON")
Submit
}
// Controller
// checkbox to save values to the database.
[HttpPost]
public ActionResult SelectedValuesSaved(Application_Check checkList, FormCollection frm)
{
if(ModelState.IsValid)
{
var selectedAnswer = checkList.SelectedAnswer;
}
return View();
}
// Model
public class ApplicationName
{
public string SelectedAnswer { get; set; }
}
Sachin SinghPosted Nov 26, 2021, 6:22 AM
Guest UserPosted Nov 26, 2021, 5:49 AM
Vikas PanwarPosted Nov 26, 2021, 5:21 AM