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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:53:04+00:00 2026-05-15T19:53:04+00:00

I have a parameter for a method, that should be a string and I

  • 0

I have a parameter for a method, that should be a string and I can’t come up with how to <% *.ClientID %> to the thing as a variable like that. Since its a variable i can’t wrap it in quotes since it will be taken literally and when I use the parameter like a variable (as you’re supposed to) i get an ASP error saying it doesn’t exist in the context (reading it literally).

Any Clues?

thanks guys

Code Sample

function next(currentControl, maxLength, nextControl) { 
   if (document.getElementById( currentControl<%=.ClientID %>).value.length >= maxLength) {
         document.getElementById( nextControl<%=.ClientID %>).focus(); 
   } 
   return false; 
} 

Call Sample

wValCode.Attributes.Add("onkeyup","next('wValCode','3','wValThree')");

I know probably a primitive way of adding the attribute, but its how it was explained to me. I picked up ASP on the fly so don’t be too hard on me 😉

Static HTML

<input name="ctl00$ContentPlaceHolder2$wValThree" type="text" id="ctl00_ContentPlaceHolder2_wValThree" style="width:33px;">

That is the only related reference I can find in the static html. Would it have been added in one of ASPs convoluted js files?

  • 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-15T19:53:05+00:00Added an answer on May 15, 2026 at 7:53 pm

    Given you’re binding the key events from code behind, you can just reference the client IDs at the time that you’re doing the binding:

    wValCode.Attributes.Add("onkeyup","next('" + wValCode.ClientID + "', '3', '" + wValThree.ClientID + "')");
    

    Then, you already have the client IDs passed as parameters to the javascript function

    function next(currentControl, maxLength, nextControl) { 
       if (document.getElementById(currentControl).value.length >= maxLength) {
             document.getElementById(nextControl).focus(); 
       } 
       return false; 
    }
    

    An even better option is to pass a reference to the calling object as the first parameter, using the this keyword:

    //code behind
    wValCode.Attributes.Add("onkeyup","next(this, '3', '" + wValThree.ClientID + "')");
    
    //javascript function
    function next(currentControl, maxLength, nextControl) { 
       if (currentControl.value.length >= maxLength) {
             document.getElementById(nextControl).focus(); 
       } 
       return false; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 514k
  • Answers 514k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here is an example in awk. This code uses Jonathan's… May 16, 2026 at 6:11 pm
  • Editorial Team
    Editorial Team added an answer You can do it using Server.GetLastError Method Exception LastError; String… May 16, 2026 at 6:11 pm
  • Editorial Team
    Editorial Team added an answer It's hard to control the controls in the "fake row".… May 16, 2026 at 6:11 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am using a method that has the following signature: public static bool TryAuthenticate(string
I have a quick question that I could not figure out in the docs
I have a sql query that performs the type of select I'm after: select
I had a need for a method that could take a collection of strings,
Hello friends i am to add optional parameter to pass these in a method
The current situation is as follows: We have an production .net 3.5 WCF service,
I'm experimenting with generics in Java, and thought of this example. If I have
we have a J2EE web application usig Spring MVC. We have a new requirement
I always come to a halt when creating classes. I'm fairly intermediate to architecture
I have seen many others with similar problems but I cannot find the flaw

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.