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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:45:17+00:00 2026-05-23T02:45:17+00:00

i need to understand how i can get the access to objects asp with

  • 0

i need to understand how i can get the access to objects asp with jquery because i have a file that it’s register in page load of the code behind of my aspx that have the script need to do a validation, i read in different’s site that i can do it with this <%=txtName.UniqueID %> but doesn’t work i going to put my code and anyone could help me. thanks

the button that trigger the validation this method in the script file

    <asp:Button ID="btnOk" CssClass="btnOk" runat="server" Text="Ok" /> 

the js

$(".btnOk").click(validateData);

function validateData() {

$("form").validate({
    rules: 
    {
        '<%=txtName.UniqueID %>': "required"        
    }
});
}

my code behind where i registered the scripts

ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "<script language=javascript src='js/SetIndicators.js'> </script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "Validator", "<script language=javascript src='js/jquery.validate.js'> </script>");

UPDATE

this is the text input that i need to validate

<asp:TextBox ID="txtLayerName" CssClass="txtLayerName" runat="server"> </asp:TextBox>

With '<%=txtName.UniqueID %>' and <%=txtName.UniqueID %> doesn’t work also with '.txtLayerName'

UPDATE 2

this is the render name by asp

<input name="ctl00$ContentPlaceHolder1$txtLayerName" type="text" id="ctl00_ContentPlaceHolder1_txtLayerName" class="txtLayerName required" />
  • 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-23T02:45:18+00:00Added an answer on May 23, 2026 at 2:45 am

    jquery validate using the NAME property of html inputs, not the ID. it’s been a while since i used webforms, so i don’t know if the name and id match. but it might be worth looking into.

    EDIT: i’ve added validation on the fly with great success like so:

        $(function(){
           $("form").validate(); 
    
           $('.txtLayerName').each(function () {
    
                //add the required validator to these!
                $(this).rules('add', {required: true});
    
            }); 
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can some one please guide me to understand which jar file i need to
I don't understand the need for self-joins. Can someone please explain them to me?
I read the SDK document, but can not understand some details, need some help.
What are the top 3 main concepts in WPF that you need to understand
I understand the need to test a class that has logic (for instance, one
I know now, that if I need to get a recource in some static
Ok, I must be working too hard because I can't get my head around
In my ASP.NET MVC application, I have a project that contains all the business
I have a set of user controls on a page that are dynamically loaded
I need to understand the differences between windows main/mdi/child/dialogs.... how win32 messages should be

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.