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

  • Home
  • SEARCH
  • 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 383435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:16:57+00:00 2026-05-12T15:16:57+00:00

I need to place some validation on an asp button to ensure it is

  • 0

I need to place some validation on an asp button to ensure it is clicked at least once.

I setup a Custom Validator, set controlToValidate as the button but then found out the Custom Validator can only validate certain controls and a button isn’t one of them.

I thought about validating an invisible textbox directly next to the button but this didn’t feel right. Is creating dummy controls for this sort of thing ok? Or is it bad practice? Any advice?

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-05-12T15:16:57+00:00Added an answer on May 12, 2026 at 3:16 pm

    I will stay away from creating dummy controls. Let me ask you, why do you need to validate this? why does the user has to click on a button at least once? maybe you are using the wrong control for this, without knowing what you are trying to accomplish, I still want to suggest that you look at the possibility of using a checkbox or radio button instead. If you do, you’ll have no problems using the custom validator.

    However, if for some crazy reason you DO NEED to use a button and make sure the user clicks on it at least once, then just set a variable in your code and assign a value to it when the button is clicked. Check this variable’s value while doing your validation… if the variable still has the default value, then it means that the user didn’t click on it.

    //create variable
    private bool _isButtonClicked;
    
    //set to true when user clicks
    _isButtonClicked = true;
    
    //check if it has been clicked
    if(_isButtonClicked == true)
    

    Hope this helps.

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

Sidebar

Related Questions

I've got this url that I need to place in a link in some
In some situations I need to place a JFrame right where the mouse cursor
As a programmer I need a place to store my stuff. I've been running
For an embedded system I need to place a few data structures at fixed
I have a few models that need to have custom find conditions placed on
I'm using the Data Annotation validation extensively in ASP.NET MVC 2. This new feature
With the new ASP.NET MVC 2 validation features, we can decorate the properties of
I'm predominately a Java guy, which is why I need some assistance on what
I'm very new with ssh so I need some help to write some scripts.
I need some web hosting for testing my internal web application with my few

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.