Solved

javascript search control by partial name

Posted on 2009-04-08
3
1,577 Views
Last Modified: 2013-11-19
I am using javascript and asp.net. I have control by id "txtFirstName" inside template in the grid. aspnet wraps this control by id "ctl00_ContentPlaceHolder1_txtFirstName". I have many pages and multiple templates in my web app. I am looking for solution as to give "txtFirstName" as paarameter to the javascript function and thefunction should find the control with in the page. In this case it is "ctl00_ContentPlaceHolder1_txtFirstName".
0
Comment
Question by:ammarg52
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
Sreedhar Vengala earned 500 total points
ID: 24096484
frm = window.document.form1

for ( var f = 0; f < frm.elements.length; ++f )
{
// get one element
var ele = frm.elements[f];
// see if it is one of our txtFirstName element
      if ( ele.name.substring(ele.name.length - 12) == "txtFirstName" )
      {
            // code...
      }
}
0
 
LVL 9

Expert Comment

by:AsishRaj
ID: 24112867
var hiddenControl = '<%= txtFirstName.ClientID %>';
        document.getElementById(hiddenControl).value=assign new value

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question