AJAX $find Usefulness

Every AJAX control or extender you build has an ID on the client, accessible through get_id and set_id.  This ID is a unique ID and doesn't have to match the ID of the control it's given on the server, but the script registration process ensures that the server and client match.  So, using the ID, $find can reference the client component of any AJAX control on the page like so:

<script language="javascript" type="text/javascript">
function pageLoad()
{
 var tabs = $find("<%= tc.ClientID %>");
 //do something
}
</script>

<ajax:TabContainer ID="tc" runat="server">
 <!-- Tab Panels -->
</ajax:TabContainer>

The client component has a handy set of features, such as getting or setting the active tab index (through get_activeTabIndex and set_activeTabIndex) or polling the collection of tabs.  Each AJAX component has a client architecture you can take advantage of; it may take some getting used to that fact, but if you dig through the AJAX control toolkit code available on http://www.codeplex.com, you'll learn more about what is available to you on the client.

Published Monday, August 11, 2008 6:23 AM by bmains
Filed under:

Comments

# Link Listing - August 10, 2008

Monday, August 11, 2008 12:14 AM by Christopher Steen

Code Camps Jacksonville Code Camp 2008 [Via: Scott Dorman ] Link Collections LINKBLOG for August 10,...

# Link Listing - August 10, 2008

Monday, August 11, 2008 12:15 AM by Christopher Steen

Link Listing - August 10, 2008