Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:42:03+00:00 2026-06-05T19:42:03+00:00

I am trying to validate two checkboxes. One of them must be checked in

  • 0

I am trying to validate two checkboxes. One of them must be checked in order for the form to be valid. I would like to use a CustomValidator control, and validate on the server.

(This .ascx page is a form that is displayed on a different .aspx page.)

First I put in the checkboxes and a CustomValidator control on my .ascx page. Like this:

<tr>
        <td colspan="3">
            <input type="checkbox" runat="server" name="EmailCourse" class="" id="EmailCourse" value="" />
                Email course
<asp:CustomValidator id="CustomValidator1" runat="server" ErrorMessage="No checkbox checked" 
                 OnServerValidate="validateCheckBoxes_ServerValidate">
                </asp:CustomValidator>

        </td>
    </tr>
<tr>
        <td colspan="3">
            <input type="checkbox" runat="server" name="SpecialReport" class="" id="SpecialReport"  value="" />
                Special report
        </td>
    </tr>

Then, I added the validateCheckBoxes_ServerValidate function in the code-behind, on the .ascx.cs page, like this:

            protected void validateCheckBoxes_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (!EmailCourse.Checked && !SpecialReport.Checked)
                args.IsValid = false;
            else
                args.IsValid = true;

    }

When I try to open the page that uses this form on my local site to see what it looks like, I get an error, like this:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: ‘ASP.common_controls_specialreportform_ascx’ does not contain a definition for ‘validateCheckBoxes_ServerValidate’ and no extension method ‘validateCheckBoxes_ServerValidate’ accepting a first argument of type
‘ASP.common_controls_specialreportform_ascx’ could be found (are you missing a using directive or an assembly reference?)

And:

error CS1061: ‘ASP.common_controls_specialreportform_ascx’ does not contain a definition for ‘validateCheckBoxes_ServerValidate’ and no extension method ‘validateCheckBoxes_ServerValidate’ accepting a first argument of type ‘ASP.common_controls_specialreportform_ascx’ could be found (are you missing a using directive or an assembly reference?)

Does anyone know what the cause of this error is? I’m new at asp.net and am having trouble with this.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:42:04+00:00Added an answer on June 5, 2026 at 7:42 pm

    OK. So here’s what worked:

    As harry180 suggested, I did need to switch the input-type=”CheckBox” to asp:CheckBox.

    This triggered a run-time error, which I commented about above. The run-time error was because I had not recompiled the solution after making the change, in order that the ascs.designer.cs file be modified.

    After recompiling, the code works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to validate two fields. One is open time and the other
I have two textboxes, with that am trying to validate like var max =
I am trying to validate two fields one is a number and other is
While trying to validate form data on my page i get the following error:
I'm trying to validate user input, which is just comma separated numbers. I'd like
I'm trying to validate a system path. This path is valid if it begins
I am trying to validate a phone number which is contained over two fields.
I'm trying to use GridBagLayout to position labels in two rows, but I want
I m a newbie in Spring Roo. I m trying to use two databases(Mysql).
I'm trying to validate a form using the validate plugin for jquery. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.