Calling an ASP generated button click from a javascript
<p>I've following button on my web control,</p>

<pre><code>&lt;asp:Button runat="server" ID="btnSave" Text="Save" onclick="btnSave_Click"  OnClientClick="myShowWaitScreenWithNoClose('Processing...', 'Saving survey.Please wait it may take minutes..');" CssClass="buttons" Height="46px" Width="212px" Visible="false"  /&gt;
</code></pre>

<p>and I'm trying to click this button using JavaScript from code behind. Like,</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{

 if (!IsPostBack)
   {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "scr", "setTimeout(function(){document.getElementById('btnSave').click(); return false;}, 180000);", true);
   }
}
</code></pre>

<p>But it throws an error <code>Error: TypeError: document.getElementById(...) is null</code></p>
