Hi kingkomand2o,
Refer below sample code.
Controller
public class HomeController : Controller
{
// GET: /Home/
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Save()
{
return View("Index");
}
}
View
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Index</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('#btnSave').on('click', function () {
$('#lblMessage').hide();
var isValid;
if ($('#dvQuestion .dot:checked').length > 0) {
isValid = true;
} else {
$('#lblMessage').show();
isValid = false;
}
return isValid;
});
});
</script>
</head>
<body>
<%using (Html.BeginForm("Save", "Home", FormMethod.Post, new { @class = "form-horizontal", role = "form", enctype = "multipart/form-data" }))
{ %>
<input type="hidden" id="hfQuestionId" name="hfQuestionId" value="1" />
<div class="container" id="dvQuestion">
<div class="col-lg-7" style="direction: rtl;">
<div class="row">
<%:Html.RadioButton("Question", "1", new { @class = "form-control dot", id = "Question1" }) %>
<h5 style="padding-top: 3px; padding-right: 8px;">Yes</h5>
</div>
<div class="row">
<%:Html.RadioButton("Question", "2", new { @class = "form-control dot", id = "Question1" }) %>
<h5 style="padding-top: 3px; padding-right: 8px;">Probably</h5>
</div>
<div class="row">
<%:Html.RadioButton("Question", "3", new { @class = "form-control dot", id = "Question1" }) %>
<h5 style="padding-top: 3px; padding-right: 8px;">No</h5>
</div>
</div>
</div>
<span id="lblMessage" style="display: none; color: Red;">Please select one option</span>
<br />
<button id="btnSave" type="submit" class="btn btn-success">Save</button>
<%} %>
</body>
</html>
Screenshot