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. General Programming
  3. .NET (Core and Framework)
  4. Page.ClientScript.RegisterClientScriptBlock Not Working in my page

Page.ClientScript.RegisterClientScriptBlock Not Working in my page

Scheduled Pinned Locked Moved .NET (Core and Framework)
toolsquestion
7 Posts 5 Posters 2 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.
  • J Offline
    J Offline
    jintalPatel
    wrote on last edited by
    #1

    Hi In my page i write like this: Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Msg","<script>alert('Employee information is not valid...');</script>",true); But no popup window open ..is this right code?

    L A 2 Replies Last reply
    0
    • J jintalPatel

      Hi In my page i write like this: Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Msg","<script>alert('Employee information is not valid...');</script>",true); But no popup window open ..is this right code?

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

      Try following code.

      Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Msg","<script>alert('Employee information is not valid...');</script>",false);

      You were supplied last argument as true, which denotes that it will add script tag automatically. While you already provided script tag. HTH

      Jinal Desai - LIVE Experience is mother of sage....

      J 1 Reply Last reply
      0
      • J jintalPatel

        Hi In my page i write like this: Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Msg","<script>alert('Employee information is not valid...');</script>",true); But no popup window open ..is this right code?

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        Do You have AJAX Script Manager in your web page. If you then you need to use ScriptManager.RegisterClientScriptBlock.

        Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net | Follow Me @ twitter Read my Latest Article :Mastering Debugging in VS 2010

        N 1 Reply Last reply
        0
        • A Abhijit Jana

          Do You have AJAX Script Manager in your web page. If you then you need to use ScriptManager.RegisterClientScriptBlock.

          Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net | Follow Me @ twitter Read my Latest Article :Mastering Debugging in VS 2010

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

          ScriptManager is not necessary to inject script blocks into the page, even if you are using Ajax.


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

          A 1 Reply Last reply
          0
          • N Not Active

            ScriptManager is not necessary to inject script blocks into the page, even if you are using Ajax.


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

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            Mark Nischalke wrote:

            ScriptManager is not necessary to inject script blocks into the page, even if you are using Ajax.

            Agree Mark. I just asked him to check if he has used scriptmanager then he need to use scriptmanager.register.. Yes, this is not necessary. But It can be used.

            Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net | Follow Me @ twitter Read my Latest Article :Mastering Debugging in VS 2010

            1 Reply Last reply
            0
            • L Lost User

              Try following code.

              Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Msg","<script>alert('Employee information is not valid...');</script>",false);

              You were supplied last argument as true, which denotes that it will add script tag automatically. While you already provided script tag. HTH

              Jinal Desai - LIVE Experience is mother of sage....

              J Offline
              J Offline
              jintalPatel
              wrote on last edited by
              #6

              I tried making last argument false as well but it still not giving the popup block

              D 1 Reply Last reply
              0
              • J jintalPatel

                I tried making last argument false as well but it still not giving the popup block

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                Are you trying to get that script executed when the page is sent back to the browser?? This question should really be asked in the ASP.NET forum.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008
                But no longer in 2009...

                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