Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. UpdatePanel and controls with javascript

UpdatePanel and controls with javascript

Scheduled Pinned Locked Moved ASP.NET
questionjavascriptsysadmintutoriallearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 1033907
    wrote on last edited by
    #1

    Suppose I have a server control which executes some javascript function on every page postback. For the sake of simplicity, let's say it renders like this:

    My control
    window.alert('My control is in the page');

    This, of course, works, a popup window is displayed on every postback. Now imagine that the control is nested in an UpdatePanel control. Then the popup is displayed on full page postbacks, but not on partial postbacks where only the UpdatePanel is refreshed (although the javascript is still rendered to the page, it is not executed). My question is: How do I execute some javascript function on truly every postback, partial or full? It is obvious that "standard" methods for such scenario, like RegisterClientStartupScript, are out of the question. (As an example, if I want to write my own Timer server control, I need the execute some javascript which after some time interval causes postback. This is easy with full page postbacks, when this javascript is normally executed, but when the Timer is in UpdatePanel (and enabled during partial postback), I need to run the javascript after the partial postback, which I cannot see how.)

    modified on Tuesday, February 16, 2010 3:30 PM

    N 1 Reply Last reply
    0
    • M Member 1033907

      Suppose I have a server control which executes some javascript function on every page postback. For the sake of simplicity, let's say it renders like this:

      My control
      window.alert('My control is in the page');

      This, of course, works, a popup window is displayed on every postback. Now imagine that the control is nested in an UpdatePanel control. Then the popup is displayed on full page postbacks, but not on partial postbacks where only the UpdatePanel is refreshed (although the javascript is still rendered to the page, it is not executed). My question is: How do I execute some javascript function on truly every postback, partial or full? It is obvious that "standard" methods for such scenario, like RegisterClientStartupScript, are out of the question. (As an example, if I want to write my own Timer server control, I need the execute some javascript which after some time interval causes postback. This is easy with full page postbacks, when this javascript is normally executed, but when the Timer is in UpdatePanel (and enabled during partial postback), I need to run the javascript after the partial postback, which I cannot see how.)

      modified on Tuesday, February 16, 2010 3:30 PM

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      How to call client-side Javascript once an UpdatePanel request is over[^] Or you could refresh the update panel from JavasScript Easily refresh an UpdatePanel, using JavaScript[^] and call your script from there.


      I know the language. I've read a book. - _Madmatt

      M 1 Reply Last reply
      0
      • N Not Active

        How to call client-side Javascript once an UpdatePanel request is over[^] Or you could refresh the update panel from JavasScript Easily refresh an UpdatePanel, using JavaScript[^] and call your script from there.


        I know the language. I've read a book. - _Madmatt

        M Offline
        M Offline
        Member 1033907
        wrote on last edited by
        #3

        Thanks, this helped a lot. I also learned that ScriptManager.RegisterStartupScript method simplifies this functionality. H

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups