One way to do this is to create a generated JavaScript server that associates the generated identifier with a friendlier name. You can access the generated identifier using the ClientID property. For instance:
<asp:Label runat="server" ID="myInfo" Text="Initial text" /> <script type="text/javascript"> function RegObj(clientId, anId) { eval('window.' + clientId + ' = document.getElementById(anId)'); } RegObj('mytext', '<%= myInfo.ClientID %>'); mytext.innerHTML = 'my text'; </script>
This message identifier includes any manipulation performed using master pages, nested controls, etc.
source share