My Custom Web Control (ascx)
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CustomAutoCompleteTextBox.ascx.cs" Inherits="UserControls_CustomAutoCompleteTextBox" ClientIDMode="Static" %>
<asp:TextBox ID="AutoCompleteTextBox" runat="server" />
Implementation on webpage EquipmentMove
<%@ Page Language="C#" MasterPageFile="~/SiteMasterPage.master" AutoEventWireup="true" CodeFile="EquipmentMove.aspx.cs" Inherits="Equipment_EquipmentMove" %>
<Custom:AutoCompleteTextBox runat="server" ID="HardwareSNTextBox1"
OnCloseFunction="TestOnClosefunction"
OnFocusFunction="testme"
OnKeyUpFunction="EquipmentSearchCheckHardwareSNLength"
PostbackURL="EquipmentMove.aspx/HardwareSNAutoComplete"
SpellCheck="false" />
At runtime the Custom:AutoCompleteTextBox control's client ID becomes "HardwareSNTextBox1_AutoCompleteTextBox". Resulting markup:
<input name="ctl00$cpBody$HardwareSNTextBox1$AutoCompleteTextBox" type="text" id="ctl00_cpBody_HardwareSNTextBox1_AutoCompleteTextBox" class="ui-autocomplete-input" autocomplete="off">
If I want to write a javascript called "TestOnClosefunction" on the EquipmentMove webpage and I want access this control but using it's originally entered ID of "HardwareSNTextBox1" and not "HardwareSNTextBox1_AutoCompleteTextBox" is this even possible?
Edit: I suppose if the developer using this custom web control examines the markup for the actual ID while writing their js, then that could work. Not very intuitive though.