Running Javascript with Ajax
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?
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?
RE: Running Javascript with Ajax
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?