Click here to Skip to main content
13,198,467 members (55,767 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Howto » Downloads

Stats

214.7K views
21 bookmarked
Posted 1 Feb 2007

ASP.NET: How to Resolve Client ID

, 1 Feb 2007
A method to resolve the client IDs of controls in containers.
/// <summary>
/// FileName: mycontrol.js
/// 
/// Purpose: javascript to test container prefix
/// 
/// Author: 0garcia (og-bit.com) 
/// 
/// Article: How to resolve client id
///
/// Update/Fix History:
/// 0g01302007 Initial Implementation
/// </summary>

//returns the container prefix as all controls have that on their ids
function getCrtlPrefix()
{
	var prefix;
		
	var	objCrtlPrefix = document.getElementById("ctrlPrefix");
		
	if (objCrtlPrefix)
		prefix = objCrtlPrefix.value;
			
	return prefix;
}

function readValue(ctrlName)
{
	var prefix = getCrtlPrefix();	
	var	objCrtl = document.getElementById(prefix + ctrlName);
	
	if (objCrtl)
		alert ( "Prefix: " + prefix + " - value: " + objCrtl.value);
	else
		alert("not found!");
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ozkar garcia
Architect OG-BITechnologies
United States United States

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171020.1 | Last Updated 1 Feb 2007
Article Copyright 2007 by ozkar garcia
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid