Initial call to UpdatePanel
I am using UpdatePaenl on asp.net page. It has a button to bring it up. I can show "Loading" when the button is clicked. Here's my problem: I need it to show "Loading" on the first page, not just when the button is clicked.
I would assume JavaScript would be used to trigger the UpdatePanel on the first page load.
Any ideas are appreciated. Thanks to
0
a source to share
1 answer
You should be able to do this in javascript by setting up an event to fire after the page has loaded:
// Define the pg_Loaded() function as the handler for the PageLoaded event
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pg_Loaded);
var blnFirstPageVisit = true;
function pg_Loaded()
{
if (blnFirstPageVisit == true)
{
// Display loading animation
fnToggleLoading();
// Trigger button postback event
<asp:literal runat="server" id="ltlExecute" />
// Prevent this from firing a second time after the postback completes
blnFirstPageVisit = false;
}
}
In ASP, set literal text like this:
ltlExecute.Text = ClientScript.GetPostBackEventReference(btnExecute, "")
More information exists on MSDN: http://msdn.microsoft.com/en-us/library/bb311028.aspx
+1
a source to share