Running Javascript with Ajax

Discussion in 'ASP .Net' started by Wannabe, Apr 3, 2008.

  1. Wannabe

    Wannabe Guest

    I have a page that has the following Javascript on it:

    Page.ClientScript.RegisterStartupScript(typeof(string), "OpenWindow",
    "<script langauge='javascript'>OpenNewWindow('MyPage.aspx', '" + queryString
    + "', 'anotherName');</script>");

    I was asked to add Ajax to the grid so it would load faster. Trouble is when
    I did that, it broke the above line of code. When a user selects an item in
    the grid, it should open a new window with the information from the row they
    clicked. I verified that the code is being hit, but the javascript does not
    run. Can anyone tell me how I can get the javascript to run with it being in
    an Ajax update panel?
     
    Wannabe, Apr 3, 2008
    #1
    1. Advertising

  2. Wannabe

    Wannabe Guest

    RE: Running Javascript with Ajax -- Fixed

    I found out that I needed to be using ScriptManager.RegisterStartupScript,
    then it worked as before.

    "Wannabe" wrote:

    > I have a page that has the following Javascript on it:
    >
    > Page.ClientScript.RegisterStartupScript(typeof(string), "OpenWindow",
    > "<script langauge='javascript'>OpenNewWindow('MyPage.aspx', '" + queryString
    > + "', 'anotherName');</script>");
    >
    > I was asked to add Ajax to the grid so it would load faster. Trouble is when
    > I did that, it broke the above line of code. When a user selects an item in
    > the grid, it should open a new window with the information from the row they
    > clicked. I verified that the code is being hit, but the javascript does not
    > run. Can anyone tell me how I can get the javascript to run with it being in
    > an Ajax update panel?
     
    Wannabe, Apr 3, 2008
    #2
    1. Advertising

  3. Adding "AJAX" to a grid won't make it load faster. It still has to go to the
    server, execute the method that gets the data, and marshal it back over
    XMLHTTP to repopulate the grid. In fact, because of the client-side JSON
    script manipulation, it may very likely load "slower".
    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short Urls & more: http://ittyurl.net


    "Wannabe" wrote:

    > I have a page that has the following Javascript on it:
    >
    > Page.ClientScript.RegisterStartupScript(typeof(string), "OpenWindow",
    > "<script langauge='javascript'>OpenNewWindow('MyPage.aspx', '" + queryString
    > + "', 'anotherName');</script>");
    >
    > I was asked to add Ajax to the grid so it would load faster. Trouble is when
    > I did that, it broke the above line of code. When a user selects an item in
    > the grid, it should open a new window with the information from the row they
    > clicked. I verified that the code is being hit, but the javascript does not
    > run. Can anyone tell me how I can get the javascript to run with it being in
    > an Ajax update panel?
     
    Peter Bromberg [C# MVP], Apr 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    20
    Views:
    1,942
    d1srupt3r
    Mar 31, 2008
  2. darrel

    beginner AJAX questions (AJAX.net)

    darrel, Apr 27, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    2,477
    Flinky Wisty Pomm
    Apr 28, 2006
  3. jobs
    Replies:
    0
    Views:
    386
  4. minnie
    Replies:
    1
    Views:
    761
    Andrew Thompson
    Dec 13, 2006
  5. Nathan Sokalski
    Replies:
    2
    Views:
    518
    Nathan Sokalski
    Jun 2, 2007
Loading...

Share This Page