validation on back end as well as on front end in ASP.NET MVC
for the feedback rating system as shown in the picture for 2 cases
1 By default one star i seelcted
2 The selection/filling of the star is mandatory
the html code
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl>" %>
| <%=i %>. | <%=item.QuestionText %><%} %> <% if (item.FbQTypeId != 1) {%> <%} %> <% else { %> |
// var rateval;
//function getRating(val) {
// rateval = val;
//};
//$(function () {
// debugger;
// var $radios = $('input:radio[value=1]');
// if ($radios.is(':checked') === false) {
// alert('Checking the star is mandatory');
// $radios.filter('[value=1]').prop('checked', true);
// }
//});
//$(function () {
// debugger;
// alert('Checking the star is mandatory');
//});
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Puneet KankarRank #446 · 5.6K reputationPosted Jul 24, 2017, 3:12 AM EDT