ASP.NET .addClass Error Box Does Not Appear



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I have a page that allows user to select desired schedule to run a task.



enter image description here



Users can select multiple schedules. e.g. Daily + Weekly



Condition:
If Weekly checkbox is ticked, Select Day of Week must have at least 1 day selection.



var divDay = document.getElementById("divSelectDay");
var execSch = document.getElementById("ddlExecutionSchedule");

var checkbox = execSch.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else
if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';




function ShowCheckBox(ddlId)
var ControlName = document.getElementById(ddlId.id);
var day = document.getElementById("divSelectDay");

if (ControlName.value == "Weekly")

day.style.display = 'block';
dat.style.display = 'none';

else
day.style.display = 'none';
dat.style.display = 'none';



// Toggles Weekly (Day) execution schedule.
function ToggleExecutionSchedule(controlId)
var frmControl = document.getElementById(controlId.id);
var divDay = document.getElementById("divSelectDay");

var checkbox = frmControl.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)

if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else

if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';






On the same .ascx page, I have a SAVE button that validates the page input:



function SaveGroupCheck() {
var isValid = true;
var haveError = false;

var schedule = document.getElementById("<%=ddlExecutionSchedule.ClientID%>").value;
if (schedule == "Weekly")

var xday = document.getElementById("<%=chkSelectDay.ClientID%>");
var checkbox = xday.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
counter++;



if (counter < 1)
$("#chkSelectDay").addClass('errorbox');
$("#divSelectDay").addClass('has-error has-feedback');
$("#lblSelectDay").addClass('has-error has-feedback');
haveError = true;

else
$("#chkSelectDay").removeClass('errorbox');
$("#divSelectDay").removeClass('has-error has-feedback');
$("#lblSelectDay").removeClass('has-error has-feedback');



if (!isValid || !haveError)
document.getElementById("<%=txtCheckPostback.ClientID%>").value = "Save";
waitingDialog.show('Saving Changes...');
__doPostBack();


else
waitingDialog.hide();
showErrorPopup("Please enter required information for all highlighted fields");



Right now, my SAVE button allows the settings to be saved when user ticks Weekly without Select Day of Week selected.



May I know what did I miss? Thank you for your time.




HTML:



<div class="form-group" id="divExecutionSchedule">
<label class="control-label col-md-2" id="lblExecutionSchedule">Execution Schedule</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckboxList ID="ddlExecutionSchedule" ClientIDMode="Static" CssClass="chkLabel" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table" onchange="ToggleExecutionSchedule(this)" >
<asp:ListItem Text="Daily" Value="Daily"></asp:ListItem>
<asp:ListItem Text="Weekly" Value="Weekly"></asp:ListItem>
</asp:CheckboxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="executionScheduleError"></div>
</div>
</div>

<div class="form-group" id="divSelectDay" >
<label class="control-label col-md-2" id="lblSelectDay">Select Day of Week</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckBoxList ID="chkSelectDay" CssClass="chkLabel" ClientIDMode="Static" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table">
<asp:ListItem Value="Monday">Mon</asp:ListItem>
<asp:ListItem Value="Tuesday">Tue</asp:ListItem>
<asp:ListItem Value="Wednesday">Wed</asp:ListItem>
<asp:ListItem Value="Thursday">Thu</asp:ListItem>
<asp:ListItem Value="Friday">Fri</asp:ListItem>
<asp:ListItem Value="Saturday">Sat</asp:ListItem>
<asp:ListItem Value="Sunday">Sun</asp:ListItem>
</asp:CheckBoxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="selectDayError"></div>
</div>
</div>

<div class="text-right">
<button id="btnSave" class="btn btn-success btn-md" onclick="return preSave();"><span class="fa fa-floppy-o" aria-hidden="true"></span>Save</button>
</div>









share|improve this question






















  • Did you debug the SaveGroupCheck function? Is it the 'if' or 'else' part that get executed in that method(the last one: if (!isValid || !haveError)) ?

    – Boney
    Nov 14 '18 at 2:55











  • @Boney yes it was executed. There are other validations, and they were caught at the last part. Just that validation for this module was not detected.

    – gymcode
    Nov 14 '18 at 2:59











  • ok. I meant to ask was it the 'if' or the 'else' clause that got executed?

    – Boney
    Nov 14 '18 at 3:15






  • 1





    I'm guessing you need to return false; in the else clause to stop the postback from the button, in case validation fails.

    – Boney
    Nov 14 '18 at 3:16






  • 1





    With your same code I tried and control goes to the 'else' branch, when none of the checkbox is selected. Only thing which I have said before is you need to add return false; in the 'else' branch to prevent the postback from button.

    – Boney
    Nov 15 '18 at 4:48

















1















I have a page that allows user to select desired schedule to run a task.



enter image description here



Users can select multiple schedules. e.g. Daily + Weekly



Condition:
If Weekly checkbox is ticked, Select Day of Week must have at least 1 day selection.



var divDay = document.getElementById("divSelectDay");
var execSch = document.getElementById("ddlExecutionSchedule");

var checkbox = execSch.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else
if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';




function ShowCheckBox(ddlId)
var ControlName = document.getElementById(ddlId.id);
var day = document.getElementById("divSelectDay");

if (ControlName.value == "Weekly")

day.style.display = 'block';
dat.style.display = 'none';

else
day.style.display = 'none';
dat.style.display = 'none';



// Toggles Weekly (Day) execution schedule.
function ToggleExecutionSchedule(controlId)
var frmControl = document.getElementById(controlId.id);
var divDay = document.getElementById("divSelectDay");

var checkbox = frmControl.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)

if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else

if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';






On the same .ascx page, I have a SAVE button that validates the page input:



function SaveGroupCheck() {
var isValid = true;
var haveError = false;

var schedule = document.getElementById("<%=ddlExecutionSchedule.ClientID%>").value;
if (schedule == "Weekly")

var xday = document.getElementById("<%=chkSelectDay.ClientID%>");
var checkbox = xday.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
counter++;



if (counter < 1)
$("#chkSelectDay").addClass('errorbox');
$("#divSelectDay").addClass('has-error has-feedback');
$("#lblSelectDay").addClass('has-error has-feedback');
haveError = true;

else
$("#chkSelectDay").removeClass('errorbox');
$("#divSelectDay").removeClass('has-error has-feedback');
$("#lblSelectDay").removeClass('has-error has-feedback');



if (!isValid || !haveError)
document.getElementById("<%=txtCheckPostback.ClientID%>").value = "Save";
waitingDialog.show('Saving Changes...');
__doPostBack();


else
waitingDialog.hide();
showErrorPopup("Please enter required information for all highlighted fields");



Right now, my SAVE button allows the settings to be saved when user ticks Weekly without Select Day of Week selected.



May I know what did I miss? Thank you for your time.




HTML:



<div class="form-group" id="divExecutionSchedule">
<label class="control-label col-md-2" id="lblExecutionSchedule">Execution Schedule</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckboxList ID="ddlExecutionSchedule" ClientIDMode="Static" CssClass="chkLabel" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table" onchange="ToggleExecutionSchedule(this)" >
<asp:ListItem Text="Daily" Value="Daily"></asp:ListItem>
<asp:ListItem Text="Weekly" Value="Weekly"></asp:ListItem>
</asp:CheckboxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="executionScheduleError"></div>
</div>
</div>

<div class="form-group" id="divSelectDay" >
<label class="control-label col-md-2" id="lblSelectDay">Select Day of Week</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckBoxList ID="chkSelectDay" CssClass="chkLabel" ClientIDMode="Static" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table">
<asp:ListItem Value="Monday">Mon</asp:ListItem>
<asp:ListItem Value="Tuesday">Tue</asp:ListItem>
<asp:ListItem Value="Wednesday">Wed</asp:ListItem>
<asp:ListItem Value="Thursday">Thu</asp:ListItem>
<asp:ListItem Value="Friday">Fri</asp:ListItem>
<asp:ListItem Value="Saturday">Sat</asp:ListItem>
<asp:ListItem Value="Sunday">Sun</asp:ListItem>
</asp:CheckBoxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="selectDayError"></div>
</div>
</div>

<div class="text-right">
<button id="btnSave" class="btn btn-success btn-md" onclick="return preSave();"><span class="fa fa-floppy-o" aria-hidden="true"></span>Save</button>
</div>









share|improve this question






















  • Did you debug the SaveGroupCheck function? Is it the 'if' or 'else' part that get executed in that method(the last one: if (!isValid || !haveError)) ?

    – Boney
    Nov 14 '18 at 2:55











  • @Boney yes it was executed. There are other validations, and they were caught at the last part. Just that validation for this module was not detected.

    – gymcode
    Nov 14 '18 at 2:59











  • ok. I meant to ask was it the 'if' or the 'else' clause that got executed?

    – Boney
    Nov 14 '18 at 3:15






  • 1





    I'm guessing you need to return false; in the else clause to stop the postback from the button, in case validation fails.

    – Boney
    Nov 14 '18 at 3:16






  • 1





    With your same code I tried and control goes to the 'else' branch, when none of the checkbox is selected. Only thing which I have said before is you need to add return false; in the 'else' branch to prevent the postback from button.

    – Boney
    Nov 15 '18 at 4:48













1












1








1








I have a page that allows user to select desired schedule to run a task.



enter image description here



Users can select multiple schedules. e.g. Daily + Weekly



Condition:
If Weekly checkbox is ticked, Select Day of Week must have at least 1 day selection.



var divDay = document.getElementById("divSelectDay");
var execSch = document.getElementById("ddlExecutionSchedule");

var checkbox = execSch.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else
if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';




function ShowCheckBox(ddlId)
var ControlName = document.getElementById(ddlId.id);
var day = document.getElementById("divSelectDay");

if (ControlName.value == "Weekly")

day.style.display = 'block';
dat.style.display = 'none';

else
day.style.display = 'none';
dat.style.display = 'none';



// Toggles Weekly (Day) execution schedule.
function ToggleExecutionSchedule(controlId)
var frmControl = document.getElementById(controlId.id);
var divDay = document.getElementById("divSelectDay");

var checkbox = frmControl.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)

if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else

if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';






On the same .ascx page, I have a SAVE button that validates the page input:



function SaveGroupCheck() {
var isValid = true;
var haveError = false;

var schedule = document.getElementById("<%=ddlExecutionSchedule.ClientID%>").value;
if (schedule == "Weekly")

var xday = document.getElementById("<%=chkSelectDay.ClientID%>");
var checkbox = xday.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
counter++;



if (counter < 1)
$("#chkSelectDay").addClass('errorbox');
$("#divSelectDay").addClass('has-error has-feedback');
$("#lblSelectDay").addClass('has-error has-feedback');
haveError = true;

else
$("#chkSelectDay").removeClass('errorbox');
$("#divSelectDay").removeClass('has-error has-feedback');
$("#lblSelectDay").removeClass('has-error has-feedback');



if (!isValid || !haveError)
document.getElementById("<%=txtCheckPostback.ClientID%>").value = "Save";
waitingDialog.show('Saving Changes...');
__doPostBack();


else
waitingDialog.hide();
showErrorPopup("Please enter required information for all highlighted fields");



Right now, my SAVE button allows the settings to be saved when user ticks Weekly without Select Day of Week selected.



May I know what did I miss? Thank you for your time.




HTML:



<div class="form-group" id="divExecutionSchedule">
<label class="control-label col-md-2" id="lblExecutionSchedule">Execution Schedule</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckboxList ID="ddlExecutionSchedule" ClientIDMode="Static" CssClass="chkLabel" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table" onchange="ToggleExecutionSchedule(this)" >
<asp:ListItem Text="Daily" Value="Daily"></asp:ListItem>
<asp:ListItem Text="Weekly" Value="Weekly"></asp:ListItem>
</asp:CheckboxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="executionScheduleError"></div>
</div>
</div>

<div class="form-group" id="divSelectDay" >
<label class="control-label col-md-2" id="lblSelectDay">Select Day of Week</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckBoxList ID="chkSelectDay" CssClass="chkLabel" ClientIDMode="Static" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table">
<asp:ListItem Value="Monday">Mon</asp:ListItem>
<asp:ListItem Value="Tuesday">Tue</asp:ListItem>
<asp:ListItem Value="Wednesday">Wed</asp:ListItem>
<asp:ListItem Value="Thursday">Thu</asp:ListItem>
<asp:ListItem Value="Friday">Fri</asp:ListItem>
<asp:ListItem Value="Saturday">Sat</asp:ListItem>
<asp:ListItem Value="Sunday">Sun</asp:ListItem>
</asp:CheckBoxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="selectDayError"></div>
</div>
</div>

<div class="text-right">
<button id="btnSave" class="btn btn-success btn-md" onclick="return preSave();"><span class="fa fa-floppy-o" aria-hidden="true"></span>Save</button>
</div>









share|improve this question














I have a page that allows user to select desired schedule to run a task.



enter image description here



Users can select multiple schedules. e.g. Daily + Weekly



Condition:
If Weekly checkbox is ticked, Select Day of Week must have at least 1 day selection.



var divDay = document.getElementById("divSelectDay");
var execSch = document.getElementById("ddlExecutionSchedule");

var checkbox = execSch.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else
if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';




function ShowCheckBox(ddlId)
var ControlName = document.getElementById(ddlId.id);
var day = document.getElementById("divSelectDay");

if (ControlName.value == "Weekly")

day.style.display = 'block';
dat.style.display = 'none';

else
day.style.display = 'none';
dat.style.display = 'none';



// Toggles Weekly (Day) execution schedule.
function ToggleExecutionSchedule(controlId)
var frmControl = document.getElementById(controlId.id);
var divDay = document.getElementById("divSelectDay");

var checkbox = frmControl.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)

if (checkbox[i].value == "Weekly")
divDay.style.display = 'block';

else

if (checkbox[i].value == "Weekly")
divDay.style.display = 'none';






On the same .ascx page, I have a SAVE button that validates the page input:



function SaveGroupCheck() {
var isValid = true;
var haveError = false;

var schedule = document.getElementById("<%=ddlExecutionSchedule.ClientID%>").value;
if (schedule == "Weekly")

var xday = document.getElementById("<%=chkSelectDay.ClientID%>");
var checkbox = xday.getElementsByTagName("input");
var counter = 0;
for (var i = 0; i < checkbox.length; i++)
if (checkbox[i].checked)
counter++;



if (counter < 1)
$("#chkSelectDay").addClass('errorbox');
$("#divSelectDay").addClass('has-error has-feedback');
$("#lblSelectDay").addClass('has-error has-feedback');
haveError = true;

else
$("#chkSelectDay").removeClass('errorbox');
$("#divSelectDay").removeClass('has-error has-feedback');
$("#lblSelectDay").removeClass('has-error has-feedback');



if (!isValid || !haveError)
document.getElementById("<%=txtCheckPostback.ClientID%>").value = "Save";
waitingDialog.show('Saving Changes...');
__doPostBack();


else
waitingDialog.hide();
showErrorPopup("Please enter required information for all highlighted fields");



Right now, my SAVE button allows the settings to be saved when user ticks Weekly without Select Day of Week selected.



May I know what did I miss? Thank you for your time.




HTML:



<div class="form-group" id="divExecutionSchedule">
<label class="control-label col-md-2" id="lblExecutionSchedule">Execution Schedule</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckboxList ID="ddlExecutionSchedule" ClientIDMode="Static" CssClass="chkLabel" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table" onchange="ToggleExecutionSchedule(this)" >
<asp:ListItem Text="Daily" Value="Daily"></asp:ListItem>
<asp:ListItem Text="Weekly" Value="Weekly"></asp:ListItem>
</asp:CheckboxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="executionScheduleError"></div>
</div>
</div>

<div class="form-group" id="divSelectDay" >
<label class="control-label col-md-2" id="lblSelectDay">Select Day of Week</label>
<div class="col-md-3">
<div class="input-group">
<asp:CheckBoxList ID="chkSelectDay" CssClass="chkLabel" ClientIDMode="Static" runat="server" AutoPostBack="false" CellPadding="5" CellSpacing="5" RepeatDirection="Horizontal" RepeatLayout="Table">
<asp:ListItem Value="Monday">Mon</asp:ListItem>
<asp:ListItem Value="Tuesday">Tue</asp:ListItem>
<asp:ListItem Value="Wednesday">Wed</asp:ListItem>
<asp:ListItem Value="Thursday">Thu</asp:ListItem>
<asp:ListItem Value="Friday">Fri</asp:ListItem>
<asp:ListItem Value="Saturday">Sat</asp:ListItem>
<asp:ListItem Value="Sunday">Sun</asp:ListItem>
</asp:CheckBoxList>
</div>
</div>
<label class="control-label col-md-2"></label>
<div class="col-md-10">
<div class="alert alert-danger hidden" role="alert" id="selectDayError"></div>
</div>
</div>

<div class="text-right">
<button id="btnSave" class="btn btn-success btn-md" onclick="return preSave();"><span class="fa fa-floppy-o" aria-hidden="true"></span>Save</button>
</div>






javascript jquery asp.net forms






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 2:23









gymcodegymcode

1,594104589




1,594104589












  • Did you debug the SaveGroupCheck function? Is it the 'if' or 'else' part that get executed in that method(the last one: if (!isValid || !haveError)) ?

    – Boney
    Nov 14 '18 at 2:55











  • @Boney yes it was executed. There are other validations, and they were caught at the last part. Just that validation for this module was not detected.

    – gymcode
    Nov 14 '18 at 2:59











  • ok. I meant to ask was it the 'if' or the 'else' clause that got executed?

    – Boney
    Nov 14 '18 at 3:15






  • 1





    I'm guessing you need to return false; in the else clause to stop the postback from the button, in case validation fails.

    – Boney
    Nov 14 '18 at 3:16






  • 1





    With your same code I tried and control goes to the 'else' branch, when none of the checkbox is selected. Only thing which I have said before is you need to add return false; in the 'else' branch to prevent the postback from button.

    – Boney
    Nov 15 '18 at 4:48

















  • Did you debug the SaveGroupCheck function? Is it the 'if' or 'else' part that get executed in that method(the last one: if (!isValid || !haveError)) ?

    – Boney
    Nov 14 '18 at 2:55











  • @Boney yes it was executed. There are other validations, and they were caught at the last part. Just that validation for this module was not detected.

    – gymcode
    Nov 14 '18 at 2:59











  • ok. I meant to ask was it the 'if' or the 'else' clause that got executed?

    – Boney
    Nov 14 '18 at 3:15






  • 1





    I'm guessing you need to return false; in the else clause to stop the postback from the button, in case validation fails.

    – Boney
    Nov 14 '18 at 3:16






  • 1





    With your same code I tried and control goes to the 'else' branch, when none of the checkbox is selected. Only thing which I have said before is you need to add return false; in the 'else' branch to prevent the postback from button.

    – Boney
    Nov 15 '18 at 4:48
















Did you debug the SaveGroupCheck function? Is it the 'if' or 'else' part that get executed in that method(the last one: if (!isValid || !haveError)) ?

– Boney
Nov 14 '18 at 2:55





Did you debug the SaveGroupCheck function? Is it the 'if' or 'else' part that get executed in that method(the last one: if (!isValid || !haveError)) ?

– Boney
Nov 14 '18 at 2:55













@Boney yes it was executed. There are other validations, and they were caught at the last part. Just that validation for this module was not detected.

– gymcode
Nov 14 '18 at 2:59





@Boney yes it was executed. There are other validations, and they were caught at the last part. Just that validation for this module was not detected.

– gymcode
Nov 14 '18 at 2:59













ok. I meant to ask was it the 'if' or the 'else' clause that got executed?

– Boney
Nov 14 '18 at 3:15





ok. I meant to ask was it the 'if' or the 'else' clause that got executed?

– Boney
Nov 14 '18 at 3:15




1




1





I'm guessing you need to return false; in the else clause to stop the postback from the button, in case validation fails.

– Boney
Nov 14 '18 at 3:16





I'm guessing you need to return false; in the else clause to stop the postback from the button, in case validation fails.

– Boney
Nov 14 '18 at 3:16




1




1





With your same code I tried and control goes to the 'else' branch, when none of the checkbox is selected. Only thing which I have said before is you need to add return false; in the 'else' branch to prevent the postback from button.

– Boney
Nov 15 '18 at 4:48





With your same code I tried and control goes to the 'else' branch, when none of the checkbox is selected. Only thing which I have said before is you need to add return false; in the 'else' branch to prevent the postback from button.

– Boney
Nov 15 '18 at 4:48












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292299%2fasp-net-addclass-error-box-does-not-appear%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292299%2fasp-net-addclass-error-box-does-not-appear%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)