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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:19:54+00:00 2026-06-16T03:19:54+00:00

I have problem: I have a custom validator on my page which validates imieTextbox

  • 0

I have problem:
I have a custom validator on my page which validates imieTextbox control. But it’s not working. And I don’t know why.

This method comes from register.aspx.cs file:

protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {
//of course here will be other validation logic but setting IsValid property ti false     is for example
        args.IsValid = false;
    }

And this comes fromregister.aspx file:

    <asp:CustomValidator ID="CustomValidator1" runat="server" 
             ControlToValidate="imieTextbox" Display="Dynamic" 
             ErrorMessage="CustomValidator" 
             onservervalidate="CustomValidator1_ServerValidate" ValidateEmptyText="True" 
             ValidationGroup="A"></asp:CustomValidator>

Submit button on Page has property CausesValidation set to TRUE and has Validation group A (like all validators on my page).
All validators(requiredfield validators) works fine, but custom validators is not. Why is that? What am I doing wrong?

  • 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-16T03:19:56+00:00Added an answer on June 16, 2026 at 3:19 am

    You have to call

    if (Page.IsValid) 
    

    on postback on the server, otherwise your server validation will not be called.
    The RequiredFieldValidator validates on the client, that’s why this one is working. However you should always validate on the server as well.

    For client side validation you have to write a JavaScript method doing the same. You set the attribute in your CustomValidator:

    ClientValidationFunction="YourValidationMethod"
    

    and the method does something like this

    function YourValidationMethod(source, args)
    {
       if (valid) // do check here
          args.IsValid = true;
       else
          args.IsValid = false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with Hibernate Validator 3.1.0.GA not looking up custom validation messages
I have one registration page which uses custom valiadtor public class CustomValidator implements Validator
Problem I have a custom tab control using Chrome-shaped tabs that binds to a
I have a question regarding a custom validator in my page. The custom validator
I have created a web custom control and used within an aspx page. I
So i have a ASP.NET 4 Custom Control called SafeClickButton which is designed to
I am creating a custom control which has some properties on it. The problem
I’m having some problems with validation. I have created a custom validator called RequiredFieldRule
I have problem with casting custom event currentTarget to component. When I'm trying to
I have a problem with leaking custom cells. In my overridden UITableViewController, I have,

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.