ASP.NET Validation - How to disable client script

Disable client script in validation
The following c# tutorial code demonstrates how we can disable the client script in validation. In this tutorial, we used a RequiredFieldValidator control to validate a TextBox. In the RequiredFieldValidator web server control, we disabled the client script. The RequiredFieldValidator web server control makes the associated input control a required field.

The RequiredFieldValidator EnableClientScript property gets or sets a value indicating whether client-side validation is enabled. The EnableClientScript property value is a Boolean. This property value is true if client-side validation is enabled otherwise the value is false. The default value is true.

So, using this EnableClientScript property, the developers can disable the client script while validating the web page. They just have to set this property value to false.

The c# developers can use the EnableClientScript property to specify whether client-side validation is enabled. By default, this property value is set to true which enables client-side validation if the browser supports it. The developers can disable client-side validation on a control-by-control basis.

The Validation controls always perform validation on the server. also has a complete client-side implementation that allows DHTML-supported browsers.

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e) {
        Label1.Text = "Your City: " +

<html xmlns="">
<head runat="server">
    <title>Validation example: how to disable client script</title>
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="DarkBlue"></asp:Label>
        <br />
        <asp:Label ID="Label2" runat="server" Text="City Name" AssociatedControlID="TextBox1"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
             ErrorMessage="Input City Name!"
        <br />
        <asp:Button ID="Button1" runat="server" Text="Submit City" OnClick="Button1_Click" />
Related example