Reputation: 11341
I need to autopostback my page on the first load, and i need to wait the entire page have finish loading before post back the page.
I use in the page load
if (!IsPageWasPostBack)
{
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "forcePostBack", "Sys.WebForms.PageRequestManager.getInstance().add_endRequest(postBackLoading);function postBackLoading(){__doPostBack('" + this.Page.ClientID + "','');}", true);
}
IsPageWasPostBack is a viewstate variable.
When i put
Sys.WebForms.PageRequestManager.getInstance().add_endRequest
my page dont post back. If i remove it the page post back succesfully but to fast.
I dont want use timer to call back my post back.
Any idea ?
Upvotes: 0
Views: 4905
Reputation: 1059
Have you tried using the LoadComplete event instead of the Load event?
Upvotes: 0
Reputation: 423
What about waiting a few seconds?
$(document).ready(
setTimeout('$("#myform).submit()',2000);
) ;
Upvotes: 0
Reputation: 3932
you could use jquery and use $(document).ready($("#myform).submit();) or you could wait for the ready then have a timer in your javascript just to wait a few extra seconds.
Upvotes: 3