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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:25:33+00:00 2026-05-29T22:25:33+00:00

I was reading an article to disable validators in Javascript using below mentioned reference

  • 0

I was reading an article to disable validators in Javascript using below mentioned reference

http://geekswithblogs.net/jonasb/archive/2006/08/11/87708.aspx


My practice page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        function RegexTester(ID) {
            debugger;
            var ID1 = document.getElementById('req');
            //            ValidatorEnable(
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RegularExpressionValidator ID="req" runat="server" ErrorMessage="hi" ControlToValidate="TextBox1"
            ValidationExpression="^[0-9]{7,20}$" EnableClientScript="false">
        </asp:RegularExpressionValidator>
        <asp:TextBox ID="TextBox1" runat="server" CausesValidation="false"></asp:TextBox>
        <asp:CheckBox ID="btn" runat="server" Text="Regex Tester" CausesValidation="false"
            AutoPostBack="true" />
    </div>
    </form>
</body>
</html>

Query

In the javascript function, I am unable to get the memory for required field validator control. I mean ID1 is showing null value…Why?

  • 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-05-29T22:25:34+00:00Added an answer on May 29, 2026 at 10:25 pm

    Because your validator is a server side control ASP.NET will create an unique client id for it based on control’s id and its location in markup.

    To get a client side id of your validator you should use:

    <%=req.ClientID %>
    

    Also there is a way to map all server side controls in a neat way:
    http://jagregory.com/writings/how-to-use-clientids-in-javascript-without-the-ugliness/

    If you are developing for ASP.NET 4.0 you can use ClientIDMode=”Predictable” to have better control over how ids are generated.
    More info at:
    http://weblogs.asp.net/asptest/archive/2009/01/06/asp-net-4-0-clientid-overview.aspx

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

Sidebar

Related Questions

After reading this article net.tutsplus.com/tutorials/javascript-ajax/14-helpful-jquery-tricks-notes-and-best-practices/ I came to conclusion that using this.href is more
After reading this article http://lukast.mediablog.sk/log/?p=155 I decided to use mingw on linux to compile
I was reading an article on MSDN Magazine about using the Enumerable class in
Reading this article on nginx website, I'm interested in using X-Accel-Redirect header in the
I was reading an article on Batch Processing in java over at JDJ http://java.sys-con.com/node/415321
I was just reading this article :- http://css-tricks.com/perfect-full-page-background-image/ Please note this css :- #bg
After reading this article: Using Interfaces in C++ I have decided to use the
I was reading this article about volatile fields in C#. using System; using System.Threading;
After reading this article http://camendesign.com/code/developpeurs_sans_frontieres I have decided to follow what it says and
I was reading an article: Optimizing JavaScript for Execution Speed And there is a

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.