I work on asp.net mvc web app I face issue i can't make check box no selection if value of speakstuff is null so i will not make default value false i need speak stuff when display for first time of user to display as null so how to change my code to accept if speakstuff is null then no checked by true or false my code as below :
$(document).ready(function () { $('.speak-stuff-checkbox').on('change', function () { $('.speak-stuff-checkbox').not(this).prop('checked', false); var selectedValue = $(this).val(); $('#SpeakStuff').val(selectedValue); }); }); @Html.Label("Did You Meet/Speak to Staff", htmlAttributes: new { @class = "control-label col-md-5" }) <div class="col-md-7"> <input type="checkbox" id="SpeakStuff" name="SpeakStuff" value="true" class="speak-stuff-checkbox" @(Model.SpeakStuff ? "checked" : "") disabled /> Yes <input type="checkbox" id="SpeakStuff" name="SpeakStuff" value="false" class="speak-stuff-checkbox" @(!Model.SpeakStuff ? "checked" : "") disabled /> No </div>
public class ResignationRequester { public int RequestNo { get; set; } public bool SpeakStuff { get; set; } }
when assign value to speakstuff it made as below :
obj.SpeakStuff = F6000059["REEV01"].ToString().ToUpper() == "Y" ? true : false;