Calling an ASP generated button click from a javascript

crazy_demon09

New Member
I've following button on my web control,\[code\]<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" />\[/code\]and I'm trying to click this button using JavaScript from code behind. Like,\[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\]But it throws an error \[code\]Error: TypeError: document.getElementById(...) is null\[/code\]
 
Back
Top