Question

I want to create async load of visual web part. Code behind (web part) needs some time to load data so I figure to create that in async way (on page load). Scriptmanager is placed in master page (ajax support is enabled) so I tried to do that with asp:update panel (+ update progress control - to be shown while data is not loaded) but i don't know how to do postback because I don't have any control which should be triggered to do postback (and I must not have any(!), at least to be visible). I found some documentation about SPG.AJAXSupport but solution for VS2010 doesn't have project for AJAXSupport, and solution for VS2008 (MOSS 2007) I can't open because it need some wild project templates which I can't find.

Please can somebody can give me some valuable information how can I do that (via javascript or any other reasonable way)?!? Also does somebody have binaries of SPG to send me?

My javascript code (for now) looks like:

<script language="javascript" type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
var postBackElement;

//fired when the update starts
function InitializeRequest(sender, args) {
    postBackElement = args.get_postBackElement();
    var mainPanel = document.getElementById('<%=panelMain.ClientID%>');
    mainPanel.style.display = 'none';
}

//fired when the update ends
function EndRequest(sender, args) {
    //Show your update panel here
}
</script>
Was it helpful?

Solution

I think you want to use a Timer inside your UpdatePanel.

For example (from the article):

<asp:UpdatePanel runat="server" id="UpdatePanel1">
<ContentTemplate>
<asp:Timer runat="server" id="Timer1" Interval="10000" OnTick="Timer1_Tick"></asp:Timer>
<asp:Label runat="server" Text="Page not refreshed yet." id="Label1">
</asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top