How to determine ASP.NET's generated ID's from codebehind?

Posted by Matthew Scharley on Stack Overflow See other posts from Stack Overflow or by Matthew Scharley
Published on 2010-03-14T23:19:19Z Indexed on 2010/03/14 23:25 UTC
Read the original article Hit count: 191

Filed under:
|
|

In ASP.NET, when you give a tag an ID it generates a unique HTML id for the element based on the control hierachy, ie.

<asp:Panel ID="test" runat="server">
    ...
</asp:Panel>
<!-- Becomes... -->
<div id="plc_lt_zoneContent_PagePlaceholder_PagePlaceholder_lt_test_test">
    ...
</div>

Is there some way of determining the generated id in the codebehind file? I need to generate some Javascript that uses the id.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript