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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:36:39+00:00 2026-06-13T14:36:39+00:00

When we have some controls in ASP.NET, it’s of course preferable to use both

  • 0

When we have some controls in ASP.NET, it’s of course preferable to use both clientside and serverside validation. Clientside for usability purposes, and serverside for security purposes.

However, this easily gets quite ugly. Of course, if your validation is a length check or a regular expression, it is easy to maintain. However, let’s say that your validation is more advanced – what to do?

One way is to implement the exact same functionality in both server code and Javascript. Another way is that both calls a webservice with the same logic, but then your AJAX call has to be synchronous which in general is bad practice.

So, my question is, what’s the best way to perform both serverside and clientside validation?

  • 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-13T14:36:40+00:00Added an answer on June 13, 2026 at 2:36 pm

    Your ajax call does not have to be synchronous for validation; it just needs to be quick:

    • When the user tabs off a field, say, an ajax call is made to the service and the field displays a spinner next to it, indicating the server is validating the data.
    • If the service returns success, the spinner is replaced by a green check mark.
    • If the service returns failure, a red X, perhaps with explanatory text.
    • When the user finally clicks submit, the same validation takes place on the server (synchronously or not).

    Another option (besides @user133811’s of using JS is both places) is to find a cross-compiler, which will compile your language of choice into JavaScript. These may or may not be available, however.

    I’ve generally found that doing complex validation on the client is unnecessary and undesirable. Yes, let me know a field is required, or if a username exists (via ajax), or simple things, but if this is a complex mortgage application or something, I expect I’ll have to submit before finding out I need to include my W2 if I declare my pet goldfish as co-signatory (or whatever, you get the point).

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

Sidebar

Related Questions

I have 2 asp.net textboxes in an update panel. Both textbox controls have some
I have an ASP.NET page using the AJAX control toolkit for some controls. A
I have a ASP.NET Web Forms application and I'm using some dynamic controls in
I have an asp.net form that contains some html, 2 controls a calendar from
I have an ASP.net page which contains some controls. I generate this controls by
Within an asp.net webform I have some jquery that controls the positioning of elements
I use VS2010,C# to develop ASP.NET web app, I have some two text boxes,
Hi I have some controls on an asp.net modal which I show manually via
On an ASP.NET-MVC2 project, I have built some user controls that resides in Views\Shared\EditorTemplates
I have some user controls in ASP.NET that I am using as simply HTML,

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.