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. AJAX avoid using Reponse.write

AJAX avoid using Reponse.write

Scheduled Pinned Locked Moved ASP.NET
javascripthelptutorial
7 Posts 5 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.
  • C Offline
    C Offline
    cisco2103
    wrote on last edited by
    #1

    Our company is wanting to implement AJAX and it has been my task to get everything up and running. One of the major issues that I have run into is throughout our application we use response.write to use JavaScript files in our basepage. See Example: Response.Write("") Response.Write("") I have been trying for the page few days to use ClientScript.RegisterStartupScript or ClientScript.RegisterClientScriptBlock()but with no luck. My Ajax section is working without the response.write but with them I get the dreaded sys.webforms.pagerequestmanagerparserErrorException error. Any kind of suggestions will be great. Thanks, Cisco2103

    N C 2 Replies Last reply
    0
    • C cisco2103

      Our company is wanting to implement AJAX and it has been my task to get everything up and running. One of the major issues that I have run into is throughout our application we use response.write to use JavaScript files in our basepage. See Example: Response.Write("") Response.Write("") I have been trying for the page few days to use ClientScript.RegisterStartupScript or ClientScript.RegisterClientScriptBlock()but with no luck. My Ajax section is working without the response.write but with them I get the dreaded sys.webforms.pagerequestmanagerparserErrorException error. Any kind of suggestions will be great. Thanks, Cisco2103

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

      Why is it necessary to write out the script tags? Can't they just be placed on the page directly? You need to add these to the header section of the page. RegisterClientScript places them in form. You could try overriding the Init or PreInit for the page and inserting them then.


      only two letters away from being an asset

      C 1 Reply Last reply
      0
      • N Not Active

        Why is it necessary to write out the script tags? Can't they just be placed on the page directly? You need to add these to the header section of the page. RegisterClientScript places them in form. You could try overriding the Init or PreInit for the page and inserting them then.


        only two letters away from being an asset

        C Offline
        C Offline
        cisco2103
        wrote on last edited by
        #3

        I've tried putting them in the header section of the page but with no luck. Not very familiar with Init and PreInit since I am pretty new to .Net What would I accomplish by doing this?

        N G 2 Replies Last reply
        0
        • C cisco2103

          I've tried putting them in the header section of the page but with no luck. Not very familiar with Init and PreInit since I am pretty new to .Net What would I accomplish by doing this?

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

          cisco2103 wrote:

          I am pretty new to .Net

          Perhaps you should step back do some research first.


          only two letters away from being an asset

          M 1 Reply Last reply
          0
          • C cisco2103

            I've tried putting them in the header section of the page but with no luck. Not very familiar with Init and PreInit since I am pretty new to .Net What would I accomplish by doing this?

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            cisco2103 wrote:

            I've tried putting them in the header section of the page but with no luck.

            Just add Literal controls with the script as text, as children to Page.Header.

            cisco2103 wrote:

            Not very familiar with Init and PreInit since I am pretty new to .Net What would I accomplish by doing this?

            Nothing, really. It doesn't matter much when you add the controls to the page, as long as it's done before the renderinging, and that only rules out the Unload and Disposed events, AFAIK.

            --- single minded; short sighted; long gone;

            1 Reply Last reply
            0
            • N Not Active

              cisco2103 wrote:

              I am pretty new to .Net

              Perhaps you should step back do some research first.


              only two letters away from being an asset

              M Offline
              M Offline
              Mugzy
              wrote on last edited by
              #6

              I would think asking an asp.net question on a forum devoted to asp.net could be considered a form of research.

              1 Reply Last reply
              0
              • C cisco2103

                Our company is wanting to implement AJAX and it has been my task to get everything up and running. One of the major issues that I have run into is throughout our application we use response.write to use JavaScript files in our basepage. See Example: Response.Write("") Response.Write("") I have been trying for the page few days to use ClientScript.RegisterStartupScript or ClientScript.RegisterClientScriptBlock()but with no luck. My Ajax section is working without the response.write but with them I get the dreaded sys.webforms.pagerequestmanagerparserErrorException error. Any kind of suggestions will be great. Thanks, Cisco2103

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

                Use RegisterClientScriptBlock to add javascript to your page. Better yet, as you're referencing .js files ( which is always better ), just put the code direct into the aspx. I tend to use registerclientscript block to create variables in my script which give me the names of ASP.NET generated controls, so I can interact with them in my javascript/AJAX code.

                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                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