-1

I need help in this issue I make checkbox for days and even i checked the checkbox to know in C# if it true or false every time return false please check the Code below .. please help

BootStrap Code

<form class="form-horizontal" role="form">
    <div class="checkbox checkbox-primary">
        <input runat="server" id="checkStar" type="checkbox" data-provide="checkbox"  />
        <label for="checkbox2">Saturday</label>
    </div>

    <div class="checkbox checkbox-primary">
        <input runat="server" id="checkSun" type="checkbox"/>    
        <label for="checkbox2">Sunday</label>
    </div>    

    <div class="checkbox checkbox-primary">
        <input runat="server" id="checkmon" type="checkbox" />
        <label for="checkbox2">monday</label>
    </div>

    <div class="checkbox checkbox-primary">
        <input  runat="server" id="chectu" type="checkbox"/>
        <label for="checkbox2">tuesday</label>
    </div>

    <div class="checkbox checkbox-primary">
        <input  runat="server" id="checwe" type="checkbox"/>
        <label for="checkbox2">thursday</label>
    </div> 

</form>

C# Code

if (checkStar.Checked == false & checkmon.Checked == false & chectu.Checked == false & checwe.Checked == false)
{              
    textbox1.text="please select one day";
    retuern;
}
Erik Philips
  • 53,428
  • 11
  • 128
  • 150
  • 1
    Without seeing the rest of your page or code. Are you nesting
    tags from bootstrap examples inside the
    tags provided from a WebForm page or masterpage? http://stackoverflow.com/questions/7544454/can-we-use-multiple-forms-in-a-web-page
    – eric1825 Sep 22 '16 at 15:00
  • 1
    I doubt it's the problem, but you're using bitwise ands rather than logical ands. This is doing masking, ie, 0x2 & 0x3 == 0x2. For true and false this may look right, but it isn't. For one thing, it won't be doing any shortcutting. Also, you misspelled return. This doesn't compile. So I assume that you retyped rather than copy & pasted your code, which makes it hard to see what the real error is. – Kevin Fee Sep 22 '16 at 16:38
  • After remove
    work fine thank you a lot...
    – Ghaleb Alhaddad Sep 24 '16 at 19:24

1 Answers1

0

Try

if (!checkStar.Checked && !checkmon.Checked && !chectu.Checked && !checwe.Checked)
{
textbox1.text="please select one day";
return
}
Bene
  • 95
  • 8