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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:07:24+00:00 2026-06-16T00:07:24+00:00

How to allow user to enter only 0 or 1 in the textbox.I am

  • 0

How to allow user to enter only 0 or 1 in the textbox.I am using C#.net. Textbox has maxlength is 1.I am want to add validation expression in regular expression.I don’t want use javascript.

  • 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-16T00:07:25+00:00Added an answer on June 16, 2026 at 12:07 am

    I understand the question in the following way:

    you don’t want to use javascript only to prevent that the users enters something else than 0 or 1 but a validator which can be used on client- and on serverside.

    I would use a RangeValidator with Type="Integer" and appropriate MinimumValue and MaximumValue instead.

    <asp:RangeValidator id="Range1"
               ControlToValidate="TextBox1"
               MinimumValue="0"
               MaximumValue="1"
               Type="Integer"
               EnableClientScript="false"
               Text="The value must be from 0 to 1!"
               runat="server"/>
    

    Note: If the input control is empty, no validation functions are called and validation succeeds. Use a RequiredFieldValidator control to prevent the user from skipping an input control.

    As other have mentioned, a CheckBox might be more appropriate for this task.

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

Sidebar

Related Questions

I want to allow user to enter only english alphabets and characters. How can
I have a textbox which should allow user to enter only positive or negative
i am using javascript validation library file for validating textbox values. now i want
i have to allow user to enter only RH factor of blood like -ve,+ve
Currently, I use the following regular expression for the user to enter a password
Is there a way to only allow the user enter one word in the
In my web application, I want the user to enter only SELECT statements. I
I want to make validation in an input text field to allow the user
I have a text box that will allow the user to enter multiple authors
My system allows a user to enter a code to add points to their

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.