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 207309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:43:27+00:00 2026-05-11T17:43:27+00:00

I have a Custom Control that has multiple textbox fields and a checkbox contained

  • 0

I have a Custom Control that has multiple textbox fields and a checkbox contained within it.

If the checkbox is checked, and the user submits the form, I need to allow them to continue if the textbox’s are empty (and the checkbox is checked).

I have to implement this without javascript.

The problem is that on the OnInit event of the Custom Control, where I wire up the textboxes and their validators, I cannot access the value of the checkbox.


I have been trying to override the uniqueid of the checkbox so that in the custom controls’s OnInit event I can disable the required fieldvalidators if this.Context.Request.Form[“CheckboxId”] = “On”, but as soon as I override the uniqueID of the checkbox viewstate stopped working.

The other thing I thought of is having a custom requiredfieldvalidator that takes the Checkbox in the constructor and is disabled if the value is false.

  • 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-05-11T17:43:27+00:00Added an answer on May 11, 2026 at 5:43 pm

    Have you tried to perform the control initialization logic during the Control.Load event by overriding the Control.OnLoad method instead?
    At that stage in the control lifecycle you should be able to access the value of the CheckBox.

    As a side note, if you want to disable validation you don’t necessarily have to disable all Validator controls. Instead you can simply set the Button.CausesValidation property to False on the button that will submit the form.

    UPDATE:
    It sounds like you are building a User Control, that is a complex control made up of an aggregate of simple controls working together as a unit.
    If you want to do that entirely in code, like you would with a Custom Control, you should inherit from the CompositeControl class. That gives you the best of both worlds. The child controls initialization is then made by overriding the CreateChildControls method.

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

Sidebar

Ask A Question

Stats

  • Questions 150k
  • Answers 150k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Since the data is transient -- and small -- why… May 12, 2026 at 9:49 am
  • Editorial Team
    Editorial Team added an answer Define two tables (example A and B), with their own… May 12, 2026 at 9:49 am
  • Editorial Team
    Editorial Team added an answer Console.Write((int)response.StatusCode); HttpStatusCode (the type of response.StatusCode) is an enumeration where… May 12, 2026 at 9:49 am

Related Questions

I'm creating a custom script control in ASP.NET The purpose of the control is
Probably a long question for a simple solution, but here goes... I have a
Situation: Classic ASP application, using a custom Application Pool. Default settings. On some IIS7
I would like to accomplish two things during my build process: Run unit tests

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.