Html.CheckBoxFor() is causing validation messages to disappear

I'm working in ASP.NET MVC 3 and I'm running into an odd problem. I got a checkbox set up so the user must check it to indicate they have read the disclosure and continue. They cannot continue if they don't check this. That all works.

If they do not check the box, the validation message pops up as required, and the label is displayed in red. However, when I check the box, the label disappears with the validation message. What would cause this? I'd like the label to stay put. ;) Here's the code in the view:

    @section StepContent
    {

    <div>
        @Html.LabelFor(m => m.ApplicantAgreesToDisclosure)
        @Html.CheckBoxFor(m => m.ApplicantAgreesToDisclosure)
        @Html.ValidationMessageFor(m => m.ApplicantAgreesToDisclosure, "Please indicate that you agree to the disclosure.")
    </div>

    }

And the code in the Model:

    [DisplayName("I have read and accept the above disclosure")]
    [ESignatureRequiredValidation(ErrorMessage = "Please indicate that you agree to the disclosure.")]
    public bool ApplicantAgreesToDisclosure { get; set; }

Answers


As it turns out, there's some inline CSS causing the element to disappear. Using FireBug with Firefox and clicking on the disappearing element showed that my CSS was being overridden somewhere else. It's not a problem in my MVC code. I've marked my CSS as "!important" (meaning my bit of CSS is "important") as a temporary fix until I can find the inline code.


Need Your Help

Simple Body onload function not triggering my function

javascript css

I have this javascript function to trigger with the body onload function, but I cannot get it to work. What am I doing wrong here? Here is my fiddle and code below:

How to debug a Gruntfile with breakpoints using node-inspector, Windows 7?

node.js debugging gruntjs windows-7-x64

So I have spent the past couple days trying to get this to work with no luck. Most of the solutions I have found seem to work "okay" for debugging node applications. But I haven't had much luck deb...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.