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. javascript written in code behind not working when update panel is used

javascript written in code behind not working when update panel is used

Scheduled Pinned Locked Moved ASP.NET
javascripttoolsquestionannouncement
8 Posts 4 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
    mithun narayanan
    wrote on last edited by
    #1

    String strFilenotFound = "<script language=JavaScript> "; strFilenotFound += " var s=confirm('Do you really want to go to this page??');if(s==true){alert('ya')} else {alert('no')}"; strFilenotFound += "</"; strFilenotFound += "script>"; if (!this.IsStartupScriptRegistered("Startup")) this.RegisterStartupScript("Startup", strFilenotFound); am calling this script on a button click.Am using update panel in this page. if am using the same code in some other page without update panel it's working fine.. please provide a solution... thanks in advance..

    C A 3 Replies Last reply
    0
    • M mithun narayanan

      String strFilenotFound = "<script language=JavaScript> "; strFilenotFound += " var s=confirm('Do you really want to go to this page??');if(s==true){alert('ya')} else {alert('no')}"; strFilenotFound += "</"; strFilenotFound += "script>"; if (!this.IsStartupScriptRegistered("Startup")) this.RegisterStartupScript("Startup", strFilenotFound); am calling this script on a button click.Am using update panel in this page. if am using the same code in some other page without update panel it's working fine.. please provide a solution... thanks in advance..

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      What have you done to debug it ? See what happens when you try to use AJAX without understanding it at all ? It bites you.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      M 1 Reply Last reply
      0
      • C Christian Graus

        What have you done to debug it ? See what happens when you try to use AJAX without understanding it at all ? It bites you.

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

        M Offline
        M Offline
        mithun narayanan
        wrote on last edited by
        #3

        is there any way to fix this issue.... what is ur suggestion???

        L 1 Reply Last reply
        0
        • M mithun narayanan

          is there any way to fix this issue.... what is ur suggestion???

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          If you use updatepanel, use ScriptManager.RegisterStartupScript method.

          modified on Monday, May 18, 2009 5:52 AM

          1 Reply Last reply
          0
          • M mithun narayanan

            String strFilenotFound = "<script language=JavaScript> "; strFilenotFound += " var s=confirm('Do you really want to go to this page??');if(s==true){alert('ya')} else {alert('no')}"; strFilenotFound += "</"; strFilenotFound += "script>"; if (!this.IsStartupScriptRegistered("Startup")) this.RegisterStartupScript("Startup", strFilenotFound); am calling this script on a button click.Am using update panel in this page. if am using the same code in some other page without update panel it's working fine.. please provide a solution... thanks in advance..

            A Offline
            A Offline
            ais07
            wrote on last edited by
            #5

            Are you using master page?

            M 1 Reply Last reply
            0
            • A ais07

              Are you using master page?

              M Offline
              M Offline
              mithun narayanan
              wrote on last edited by
              #6

              no am not using master page..

              1 Reply Last reply
              0
              • M mithun narayanan

                String strFilenotFound = "<script language=JavaScript> "; strFilenotFound += " var s=confirm('Do you really want to go to this page??');if(s==true){alert('ya')} else {alert('no')}"; strFilenotFound += "</"; strFilenotFound += "script>"; if (!this.IsStartupScriptRegistered("Startup")) this.RegisterStartupScript("Startup", strFilenotFound); am calling this script on a button click.Am using update panel in this page. if am using the same code in some other page without update panel it's working fine.. please provide a solution... thanks in advance..

                A Offline
                A Offline
                ais07
                wrote on last edited by
                #7

                Write these java script code in your page source function load() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(ShowError); } function ShowError() { } Call load() On body OnLoad Event:- I hope it will work for you

                M 1 Reply Last reply
                0
                • A ais07

                  Write these java script code in your page source function load() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(ShowError); } function ShowError() { } Call load() On body OnLoad Event:- I hope it will work for you

                  M Offline
                  M Offline
                  mithun narayanan
                  wrote on last edited by
                  #8

                  Thnk u.....

                  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