windows.setInterval and ExtenderControl

Last post 01-21-2008 5:29 AM by Jin-Yu Yin - MSFT. 1 replies.

Sort Posts:

  • windows.setInterval and ExtenderControl

    01-15-2008, 12:55 PM
    • Loading...
    • nietger
    • Joined on 01-15-2008, 5:39 PM
    • Posts 1

     Hi,

    I am in the process of writing an online exam application using asp.net ajax. I would like to write an ExtenderControl to add behavior to a TextBox to display the (hours:minutes:seconds) left on a quiz and execute an OnComplete event when the time is up. It's important to point out that the display is refreshed every second (I would like to use the windows.setInterval javascript method) so a person taking the quiz knows how much time they have left. Can someone post some code that can help me write an ExtenderControl that does what I would like to do? Also, I would like to avoid using the UpdatePanel as I don't want to flood the server with too many client updates.

    Thanking you in advance
    Francis

  • Re: windows.setInterval and ExtenderControl

    01-21-2008, 5:29 AM
    Answer

    Hi,

    Thank you for your post!

    I assume you can write javascript to do it,

    windows.setInterval(function(){ document.getElementByID("the text box clientID").value = ...;},1000);

    What you should do is using this.Page.ClientScript.RegisterClientScriptBlock method or ScriptManager.RegisterStartupScript method to register the above script to client side in the custom webcontrols "override void OnPreRender(EventArgs e)".

    For more information about creating custom webcontrol, see http://msdn2.microsoft.com/zh-cn/library/zt27tfhy(VS.80).aspx

    If you have further questions,let me know!

    Best Regards,

    Sincerely,
    Jin-Yu Yin
    Microsoft Online Community Support
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter