Not able to access dynamic controls (inside ascx) using javascript (on aspx page)
<p>I have a user control (ascx) which contains a control (hidden field). In the page_load event of ascx, i have the below code:</p>

<p>HyperLink.Attributes.Add("onclick", "JavaScript:return AccessControl('" + hdnField.UniqueID + "');");
Note: The hidden field resides in .ascx file.</p>

<p>I want to access this hidden field at runtime and i have the below javascript function in aspx page that loads the usercontrol. </p>



function AccessControl(hdnFieldId)
{     
    var ctrl = document.getElementById(hdnFieldId);
    alert(ctrl);


<p>I am getting 'null' value in the alert. I tried using 'ClientID' and 'this' instead of 'UniqueId'. I am wondering why this is not working. I am using .net 2.0.</p>
