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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:02:27+00:00 2026-06-05T12:02:27+00:00

I recently found out that you need to perform some checks in the server

  • 0

I recently found out that you need to perform some checks in the server side code to check if the page is valid or not. I previously was under the assumption that execution automatically stops whens a validator finds incorrect input.

I put the following code on my events that require validation:

    if (!Page.IsValid)
        return;

Is this the correct way to do it?

Also, if my page has two validation groups will the correct group automatically run on the server (the one that was triggered by the button) or do I need to call it using Page.Validate("groupName")?

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-05T12:02:29+00:00Added an answer on June 5, 2026 at 12:02 pm

    It’s best to check on both client and server. The client part should be done automatically for you, but it’s a defensive measure to check it on the server in case someone has bypassed your UI using whatever means.

    You can assign a ValidationGroup to your button, which should be the same value as your ValidationGroup that you’ve assigned to your validators. When your button is clicked, it may perform client-side validation on the same group and, as you mentioned, will halt execution (prevent a postback).

    On the server side, you will do exactly as you mentioned:

    Page.Validate("WhateverGroup");
    if (!Page.IsValid)
       return; //Didn't pass validation
    else
       //Do whatever
    

    If you have multiple groups, then you should check each of them if applicable (some groups may not apply depending on certain conditions which is why you would generally use groups).

    EDIT

    In response to your question:

    The ‘default’ group that is checked is determined by the control that is posting the page. That is to say that if the control posting the page has “WhateverGroup” as its validation group, then only validators with “WhateverGroup” will be validated.

    Page.IsValid should only be checked after you’ve called the Page.Validate method. Page.IsValid is just a flag that essentially gets tripped at anytime you call Page.Validate and something doesn’t validate, whether you called it with or without a group.

    References:

    • Page.IsValid
    • Page.Validate()
    • Page.Validate(string)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently found out that Smarty, differently from Django template engine, does not
I recently found out that I need to use the cellspacing attribute in my
I have recently found out that there exists a method called nth_element in the
I have recently found out that no argument constructor and multiple argument constructor cannnot
Recently I found out that there are several things that one can do to
I found out recently that JList (finally!) was generified in JDK7. Why JTree and
I recently found myself writing a piece of code that executed a Core Data
I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2
I recently found out that there are actually 2 different ArrayList implementations in Java
I recently found out that a method I've been using for validating user input

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.