ASP.NET document.getElementById('<%=Control.ClientID%>'); returns null
<p>I'm trying to retrieve a server control in JavaScript. For testing purposes I am calling the JavaScript function from the page load event.</p>

<pre><code>protected void Page_Load(object sender, EventArgs e){
    ClientScript.RegisterClientScriptBlock(GetType(), "js", "confirmCallBack();", true);
}
</code></pre>

<p>And my JavaScript function is </p>

<pre><code>function confirmCallBack() {
    var a = document.getElementById('&lt;%= Page.Master.FindControl("PlaceHolderContent").FindControl("Button1").ClientID %&gt;');
    var b = document.getElementById('&lt;%=Button1.ClientID%&gt;');
}
</code></pre>

<p>my problem is that both a and b return null. Even when I view the page source the correct ClientID is returned.</p>

<p>I should add that I'm using master page.</p>

<p>Any ideas.</p>
