ASPxClientControlCollection.Get(name) Method
Obsolete. Returns a collection item identified by its unique hierarchically-qualified identifier.
Declaration
Get(
name: any
): any
Parameters
Name | Type | Description |
---|---|---|
name | any | A string value representing the hierarchically-qualified identifier of the required control. |
Returns
Type | Description |
---|---|
any | An object representing the collection item found. |
Remarks
The Get method provides you with programmatic access to a collection item by its hierarchically-qualified identifier (namely the value of the ClientID property), that uniquely identifies the object on the client side.
This method searches the collection for an item specified by the name parameter, and if found, returns the item’s object instance.
In some cases, using the Get method might be an alternative to using a control’s ClientInstanceName property. For instance, when working with templates, there might be situations when the client identifier of a web control’s top HTML element is composed dynamically within iterative loops on the client. Within each loop, you can use the static ASPxClientControl.GetControlCollection method and the Get method to evaluate the HTML element and access its corresponding client object (ASPxClient…) providing the entire required client API.
Example
This example demonstrates how the ASPxClientControl.GetControlCollection and ASPxClientControlCollection.GetByName methods can be used on the client, to access an ASPxTextBox editor’s client instance. The editor is contained within an ASPxPanel control, which is placed within the first tab page of an ASPxPageControl.
<form id="form1" runat="server">
<script type="text/javascript" >
var editorClientId = "<%=ASPxTextBox1.ClientID%>";
</script>
<dx:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0">
<TabPages>
<dx:TabPage>
<ContentCollection>
<dx:ContentControl runat="server">
<dx:ASPxPanel ID="ASPxPanel1" runat="server" Width="200px">
<PanelCollection>
<dx:PanelContent runat="server">
<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" ClientInstanceName="myTextBox" Text="Some text" Width="170px">
</dx:ASPxTextBox>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxPanel>
</dx:ContentControl>
</ContentCollection>
</dx:TabPage>
<dx:TabPage>
<ContentCollection>
<dx:ContentControl ID="ContentControl1" runat="server">
</dx:ContentControl>
</ContentCollection>
</dx:TabPage>
</TabPages>
</dx:ASPxPageControl>
<dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Get text">
<ClientSideEvents Click="function(s, e) {
var editor = ASPxClientControl.GetControlCollection().GetByName(editorClientId);
alert(editor.GetText());
}" />
</dx:ASPxButton>
</form>