Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Magnus Rahl
Aug 20, 2010
(0 votes)

Load page elements asynchronously using UpdatePanel and Timer

If you want to load your pages asynchronously element by element facebook-style to speed up the first display of the page your first choice would probably not be UpdatePanel but rather AJAX using jQuery or a similar framework.

Using updatepanels is however something that is almost always available in EPiServer projects without any modifications. So if you want to perform an asyncronous load in a single location using the “OOTB” controls, this is a way to do it:


<asp:ScriptManager runat="server />

<asp:UpdatePanel runat="server" UpdateMode="Conditional" RenderMode="Inline">

        <asp:Literal runat="server" ID="litData">Loading...</asp:Literal>
        <asp:Timer runat="server" Interval="1" OnTick="GetData" />



protected void GetData(object sender, EventArgs e)
    var timer = sender as Timer;
    if (timer != null)
        timer.Enabled = false;
        litData.Text = Loaded;

You can use this technique in databound controls as well, that is where it really might prove interesting when loading several elements which each of them load slowly. In that case you can use the sender object (the timer) as an “entry point” to the control hierarchy to get the elements you want to update (i.e. use timer.Parent.FindControl to find siblings of the timer).

Of course you’d like to put some more interesting content in your panel when it loads, I’m just illustrating the principle. Two important things to note though:

  • Be careful to disable the timer at the first call or it will continue loading the same data over and over.
  • Note the properties of the UpdatePanel. By default it loads as a block element and you might not want that, so set it to render inline. The update must also be conditional or else you’ll get very strange behaviour.
Aug 20, 2010


Lars Flågan
Lars Flågan Sep 21, 2010 10:33 AM

using the update panel for this sort of functionality is not wise. Have a look at jQuery and jTemplates.

Magnus Rahl
Magnus Rahl Sep 21, 2010 10:33 AM

As I stated in the beginning of the post jQuery or similar would be a better choice. This is to be seen as an alternative second-best approach.

Please login to comment.
Latest blogs
Stop Managing Humans in Your CMS

Too many times, a content management system becomes a people management system. Meaning, an organization uses the CMS to manage all the information...

Deane Barker | Nov 30, 2023

A day in the life of an Optimizely Developer - Optimizely CMS 12: The advantages and considerations when exploring an upgrade

GRAHAM CARR - LEAD .NET DEVELOPER, 28 Nov 2023 In 2022, Optimizely released CMS 12 as part of its ongoing evolution of the platform to help provide...

Graham Carr | Nov 28, 2023

A day in the life of an Optimizely Developer - OptiUKNorth Meetup January 2024

It's time for another UK North Optimizely meet up! After the success of the last one, Ibrar Hussain (26) and Paul Gruffydd (Kin + Carta) will be...

Graham Carr | Nov 28, 2023

Publish content to Optimizely CMS using a custom GPT from OpenAI 🤖

Do you find the traditional editor interface complicated and cluttered? Would you like an editorial AI assistant you can chat with? You can!

Tomas Hensrud Gulla | Nov 28, 2023 | Syndicated blog