?
Solved

javascript search control by partial name

Posted on 2009-04-08
3
Medium Priority
?
1,579 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This video teaches users how to migrate an existing Wordpress website to a new domain.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

718 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